Skip to content
Open
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
2 changes: 2 additions & 0 deletions include/boost/parser/concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ namespace boost { namespace parser {
concept code_unit =
std::same_as<std::remove_cv_t<T>, char> ||
std::same_as<std::remove_cv_t<T>, wchar_t> ||
#if defined(__cpp_char8_t)
std::same_as<std::remove_cv_t<T>, char8_t> ||
#endif
std::same_as<std::remove_cv_t<T>, char16_t>||
std::same_as<std::remove_cv_t<T>, char32_t>;

Expand Down
10 changes: 6 additions & 4 deletions include/boost/parser/detail/text/concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ namespace boost::parser::detail { namespace text { BOOST_PARSER_DETAIL_TEXT_NAME
#endif

template<typename T, format F>
concept code_unit = (std::same_as<T, char8_t> && F == format::utf8) ||
concept code_unit = (std::same_as<T, char> && F == format::utf8) ||
(std::same_as<T, wchar_t> && F == wchar_t_format) ||
#if defined(__cpp_char8_t)
(std::same_as<T, char8_t> && F == format::utf8) ||
#endif
(std::same_as<T, char16_t> && F == format::utf16) ||
(std::same_as<T, char32_t> && F == format::utf32) ||
(std::same_as<T, char> && F == format::utf8) ||
(std::same_as<T, wchar_t> && F == wchar_t_format);
(std::same_as<T, char32_t> && F == format::utf32);

template<typename T>
concept utf8_code_unit = code_unit<T, format::utf8>;
Expand Down
8 changes: 6 additions & 2 deletions include/boost/parser/detail/text/transcode_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ namespace boost::parser::detail { namespace text {

/** An out iterator that converts UTF-32 to UTF-8. */
#if BOOST_PARSER_DETAIL_TEXT_USE_CONCEPTS
template<std::output_iterator<char8_t> Iter>
template<std::output_iterator<char8_type> Iter>
#else
template<typename Iter>
#endif
Expand Down Expand Up @@ -1501,7 +1501,7 @@ namespace boost::parser::detail { namespace text {

/** An out iterator that converts UTF-16 to UTF-8. */
#if BOOST_PARSER_DETAIL_TEXT_USE_CONCEPTS
template<std::output_iterator<char8_t> Iter>
template<std::output_iterator<char8_type> Iter>
#else
template<typename Iter>
#endif
Expand Down Expand Up @@ -2295,11 +2295,13 @@ namespace boost::parser::detail { namespace text { BOOST_PARSER_DETAIL_TEXT_NAME

namespace boost::parser::detail { namespace text { BOOST_PARSER_DETAIL_TEXT_NAMESPACE_V2 {

#if defined(__cpp_char8_t)
template<std::output_iterator<char8_t> O>
constexpr utf_32_to_8_out_iterator<O> utf_32_to_8_out(O it)
{
return utf_32_to_8_out_iterator<O>(it);
}
#endif

template<std::output_iterator<char32_t> O>
constexpr utf_8_to_32_out_iterator<O> utf_8_to_32_out(O it)
Expand All @@ -2319,11 +2321,13 @@ namespace boost::parser::detail { namespace text { BOOST_PARSER_DETAIL_TEXT_NAME
return utf_16_to_32_out_iterator<O>(it);
}

#if defined(__cpp_char8_t)
template<std::output_iterator<char8_t> O>
constexpr utf_16_to_8_out_iterator<O> utf_16_to_8_out(O it)
{
return utf_16_to_8_out_iterator<O>(it);
}
#endif

template<std::output_iterator<char16_t> O>
constexpr utf_8_to_16_out_iterator<O> utf_8_to_16_out(O it)
Expand Down
4 changes: 4 additions & 0 deletions include/boost/parser/detail/text/transcode_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,10 @@ namespace boost::parser::detail { namespace text {
};

#if BOOST_PARSER_DETAIL_TEXT_USE_CONCEPTS
#if defined(__cpp_char8_t)
template<class R>
char8_view(R &&) -> char8_view<detail::all_t<R>>;
#endif
template<class R>
char16_view(R &&) -> char16_view<detail::all_t<R>>;
template<class R>
Expand Down Expand Up @@ -413,8 +415,10 @@ namespace boost::parser::detail { namespace text {
template<class T>
constexpr bool is_charn_view = false;
#if BOOST_PARSER_DETAIL_TEXT_USE_CONCEPTS
#if defined(__cpp_char8_t)
template<class V>
constexpr bool is_charn_view<char8_view<V>> = true;
#endif
#endif
template<class V>
constexpr bool is_charn_view<char16_view<V>> = true;
Expand Down