Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions include/iris/x4/attribute/value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,20 @@ struct fixed_value_gen
return fixed_value_parser<std::remove_cvref_t<T>>{std::forward<T>(value)};
}

[[nodiscard]] static constexpr fixed_value_parser<std::string, std::string_view>
operator()(std::string_view value)
noexcept(std::is_nothrow_constructible_v<fixed_value_parser<std::string, std::string_view>, std::string_view>)
{
return fixed_value_parser<std::string, std::string_view>{value};
}

[[nodiscard]] static constexpr fixed_value_parser<std::u32string, std::u32string_view>
operator()(std::u32string_view value)
noexcept(std::is_nothrow_constructible_v<fixed_value_parser<std::u32string, std::u32string_view>, std::u32string_view>)
{
return fixed_value_parser<std::u32string, std::u32string_view>{value};
}

template<CharArray CharArrayT>
[[nodiscard]] static constexpr string_array_attr_parser_t<CharArrayT>
operator()(CharArrayT&& char_array)
Expand Down
4 changes: 2 additions & 2 deletions test/x4/value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ TEST_CASE("attr")
}
{
[[maybe_unused]] constexpr auto attr_p = fixed_value("foo"sv);
STATIC_CHECK(std::same_as<std::remove_const_t<decltype(attr_p)>, x4::fixed_value_parser<std::basic_string_view<char>>>);
STATIC_CHECK(std::same_as<std::remove_const_t<decltype(attr_p)>, x4::fixed_value_parser<std::basic_string<char>, std::basic_string_view<char>>>);
}

{
Expand All @@ -84,7 +84,7 @@ TEST_CASE("attr")
}
{
[[maybe_unused]] constexpr auto attr_p = fixed_value(U"foo"sv);
STATIC_CHECK(std::same_as<std::remove_const_t<decltype(attr_p)>, x4::fixed_value_parser<std::basic_string_view<char32_t>>>);
STATIC_CHECK(std::same_as<std::remove_const_t<decltype(attr_p)>, x4::fixed_value_parser<std::basic_string<char32_t>, std::basic_string_view<char32_t>>>);
}

IRIS_X4_ASSERT_CONSTEXPR_CTORS(fixed_value(1));
Expand Down
Loading