You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
example.cpp needs a #include <cstdint> for std::uint32_t support
Here is the other compile errors:
[ 25%] Building CXX object example/CMakeFiles/examples.dir/main.cpp.o
cd /home/twigger/faststring/FastString/example && /usr/bin/c++ -I/home/twigger/faststring/FastString/include -O3 -O3 -DNDEBUG -std=c++20 -Wall -Wextra -pedantic -Werror -MD -MT example/CMakeFiles/examples.dir/main.cpp.o -MF CMakeFiles/examples.dir/main.cpp.o.d -o CMakeFiles/examples.dir/main.cpp.o -c /home/twigger/faststring/FastString/example/main.cpp
/home/twigger/faststring/FastString/example/main.cpp: In function ‘int main()’:
/home/twigger/faststring/FastString/example/main.cpp:39:51: error: ‘std::basic_string_view<char>{2, ((const char*)(& e.fss::basic_str<char, 7, std::char_traits<char> >::buffer_))}’ is not a constant expression
39 | constexpr auto e_sub_str = e.str().substr(0, 2); // e_sub_str is "ab"
| ^
/home/twigger/faststring/FastString/example/main.cpp:96:40: error: ‘std::basic_string_view<char>{4, ((const char*)(& t.main()::test_struct::c_.fss::basic_str<char, 7, std::char_traits<char> >::buffer_))}’ is not a constant expression
96 | constexpr const auto t_a = t.get_c();
| ^
make[2]: *** [example/CMakeFiles/examples.dir/build.make:79: example/CMakeFiles/examples.dir/main.cpp.o] Error 1
Finally you use std::size_t for your size type. This needlessly makes, eg, string64 take up 8 more bytes than necessary. Why not use something like uint8_t and have a static_assert that the size is suitable for the capacity. Or even better, have a template argument for the size type, eg using string64 = fss::fixed_size_str<62, std::uint8_t>;
The text was updated successfully, but these errors were encountered:
Nice library. Here are the issues:
example.cpp needs a
#include <cstdint>
forstd::uint32_t
supportHere is the other compile errors:
std::size_t
for your size type. This needlessly makes, eg, string64 take up 8 more bytes than necessary. Why not use something likeuint8_t
and have astatic_assert
that the size is suitable for the capacity. Or even better, have a template argument for the size type, egusing string64 = fss::fixed_size_str<62, std::uint8_t>;
The text was updated successfully, but these errors were encountered: