Closed freshFruict closed 4 months ago
Would it make sense to forward the starts_with
and ends_with
calls to std::string_view
like this?
template <typename T> bool starts_with(T&& t) constexpr { return view().starts_with(t); }
template <typename T> bool ends_with(T&& t) constexpr { return view().ends_with(t); }
If there's an option to maintain less code and still provide the same value, I would prefer that.
Can you please run clang-format?
I've lessen code. As starts_with and ends_with were added in C++ 20, forwarding calls would break C++ 17 compatibility, so I didn't use them
/home/runner/work/cista/cista/test/string_test.cc:108: FATAL ERROR: test case CRASHED: SIGABRT - Abort (abnormal termination) signal
Can you please check? :)
Not breaking C++17 compat sounds like a good idea.
generic_string: add starts_with and ends_with functions
performs a simple way to check if a string has prefix/suffix add test cases for starts_with and ends_with
fix next_power_of_two function
fix wrong sizeof comparison for 64-bit integers add sizeof comparisons for 16 and 32-bit integers