文字列ポインタから sprout::string へ変換
sprout::string_from_c_str を使えばいいみたいです。
[ソース]
#include <sprout/string.hpp> int main(){ constexpr char const* c_str = "homu"; // sprout::to_string では文字列ポインタから変換出来ない // constexpr auto str = sprout::to_string(c_str); // sprout::string_from_c_str で文字列の長さを指定して変換する constexpr auto len = sprout::char_traits<char>::length(c_str); constexpr auto str = sprout::string_from_c_str<len>(c_str); static_assert(str == "homu", ""); // コピーする文字数を指定 static_assert(sprout::string_from_c_str<2>(c_str, 2) == "ho", ""); return 0; }
他に何か手段があったかしら。