Skip to content

Commit 8b52a6c

Browse files
committed
comments
1 parent 571a11e commit 8b52a6c

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

bench/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ cmake_print_properties(TARGETS Boost::circular_buffer PROPERTIES NAME TYPE INTER
2727
CPMAddPackage("gh:google/benchmark@1.7.1")
2828

2929
# ---- Libraries -------
30-
# ---Config Lib Src ----
3130
set(libs)
3231
file(GLOB sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../src/*/*.cpp)
3332
foreach(source ${sources})

include/fssb/fixed_size_string_buffer.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class FixedSizeStringBuffer {
135135
/// @brief access element using rb[1] notation
136136
inline std::string operator[](size_t pos) const { return at(pos); }
137137
/// @brief access element using rb.at(1) notation
138-
inline std::string at(size_t pos) const; // see below
138+
inline std::string at(size_t pos) const; // implementation below
139139

140140
// ***********************************************************************
141141
/// @name Debug
@@ -178,7 +178,7 @@ class FixedSizeStringBuffer {
178178
//@}
179179

180180
private:
181-
// used for pretty print of buffer
181+
// marker for char position used for pretty print of buffer
182182
struct SlotState {
183183
std::vector<bool> bopen;
184184
std::vector<bool> bword;
@@ -227,7 +227,8 @@ void FixedSizeStringBuffer<SPACE>::push(std::string_view str)
227227
if (end < max_chars_) {
228228
// case1: str is in one segment
229229
// | [start]-->[end] |
230-
std::copy(str.begin(), str.end(), &chars_[start]);
230+
//std::copy(str.begin(), str.end(), &chars_[start]);
231+
str.copy(&chars_[start], strlen);
231232
back_ = end;
232233

233234
} else {
@@ -236,13 +237,16 @@ void FixedSizeStringBuffer<SPACE>::push(std::string_view str)
236237
// |-->[end] [start]--->|
237238
size_t seg1 = max_chars_ - start;
238239
size_t seg2 = strlen - seg1;
239-
back_ = seg2;
240240

241+
//
242+
// str.copy and std::copy take about the same time,
243+
// but syntax is cleaner with str.copy
244+
//
241245
//std::copy(&str[0], &str[seg1], &chars_[start]);
242246
//std::copy(&str[seg1], &str[strlen], &chars_[0]);
243-
244247
str.copy(&chars_[start], seg1);
245248
str.copy(&chars_[0], seg2, seg1);
249+
back_ = seg2;
246250

247251
}
248252
// use emplace object creation instead of ptr_.push_back(Pointer{start, strlen});
@@ -373,7 +377,7 @@ class fixed_size_string_buffer_utils {
373377

374378

375379
// https://stackoverflow.com/questions/39262323/print-a-string-variable-with-its-special-characters
376-
static wchar_t escaped(char const ch) {
380+
static wchar_t escaped(const char ch) {
377381

378382
// from https://en.wikipedia.org/wiki/ASCII#Control_code_chart
379383
static const std::unordered_map<int, wchar_t> k_escapes =

install/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ CPMAddPackage("gh:TheLartians/PackageProject.cmake@1.10.0")
2222
packageProject(
2323
NAME ${PROJECT_NAME}
2424
VERSION ${PROJECT_VERSION}
25+
DESCRIPTION ${PROJECT_DESCRIPTION}
2526
NAMESPACE ${PROJECT_NAME}
2627
BINARY_DIR ${PROJECT_BINARY_DIR}
2728
INCLUDE_DIR ${PROJECT_SOURCE_DIR}/../include

0 commit comments

Comments
 (0)