Skip to content

Commit 47f5d84

Browse files
committed
chore: Fix to work with sized STL string
1 parent aff0232 commit 47f5d84

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

example/efp_logger_example.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ int main() {
3434
// const auto a_1000 = std::string(1000, 'a');
3535
// info("This is a info message with a 1000 char string: {}", a_1000);
3636
// info("Does it support Korean? {}", "한글도 되나요?");
37-
info("This is a info message with a empty string: {}", std::string(""));
37+
// info("This is a info message with a empty string: {}", std::string(""));
3838

3939
return 0;
4040
}

include/efp/logger.hpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,10 @@ namespace efp {
236236
: stl_string_head_capacity);
237237

238238
// Extracting the remaining parts of the string if necessary
239-
size_t remaining_length = arg.length - stl_string_head_capacity;
239+
size_t remaining_length = arg.length > stl_string_head_capacity
240+
? arg.length - stl_string_head_capacity
241+
: 0;
242+
240243
while (remaining_length > 0) {
241244
_read_buffer->pop_front().match(
242245
[&](const StlStringData& d) {

0 commit comments

Comments
 (0)