Skip to content

Commit

Permalink
🛠 Repair usage of cv_value_type -> element_type
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePhD committed Nov 2, 2023
1 parent f2048a7 commit c07fba7
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 15 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ if(ZTD_TEXT_SCRATCH)
target_link_libraries(scratch
PRIVATE
ztd::text
ztd::text::benchmarks::barrier
)
target_include_directories(scratch PRIVATE tests/shared/include)
target_compile_options(scratch
Expand Down
7 changes: 4 additions & 3 deletions documentation/source/api/encodings/shift_jis_x0208.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ Aliases

.. doxygenvariable:: ztd::text::shift_jis_x0208

.. doxygentypedef:: ztd::text::shift_jis
.. doxygenvariable:: ztd::text::shift_jis

.. doxygentypedef:: ztd::text::shift_jis_t

.. doxygentypedef:: ztd::text::basic_shift_jis


Base Templates
--------------

.. doxygentypedef:: ztd::text::basic_shift_jis

.. doxygenclass:: ztd::text::basic_shift_jis_x0208
:members:
12 changes: 6 additions & 6 deletions include/ztd/text/any_encoding_with.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,16 +595,16 @@ namespace ztd { namespace text {
__real_decode_state& __actual_decode_state = this->_M_get_state(__state);
auto& __encoding = this->_M_get_encoding();
if constexpr (is_detected_v<__txt_detail::__detect_adl_internal_text_count_as_decoded_one,
_Encoding, _DecodeCodeUnits, __decode_error_handler, __real_decode_state>) {
auto __raw_result = text_count_as_decoded_one(::ztd::tag<_Encoding> {}, __encoding,
::std::move(__input), __error_handler, __actual_decode_state);
_DecodeCodeUnits, _Encoding, __decode_error_handler, __real_decode_state>) {
auto __raw_result = text_count_as_decoded_one(::ztd::tag<_Encoding> {}, ::std::move(__input),
__encoding, __error_handler, __actual_decode_state);
return __count_as_decoded_result(::std::move(__raw_result.input), __raw_result.count, __state,
__raw_result.error_code, __raw_result.error_count);
}
else if constexpr (is_detected_v<__txt_detail::__detect_adl_internal_text_count_as_decoded_one,
_Encoding, _DecodeCodeUnits, __decode_error_handler, __real_decode_state>) {
auto __raw_result = __text_count_as_decoded_one(::ztd::tag<_Encoding> {}, __encoding,
::std::move(__input), __error_handler, __actual_decode_state);
_DecodeCodeUnits, _Encoding, __decode_error_handler, __real_decode_state>) {
auto __raw_result = __text_count_as_decoded_one(::ztd::tag<_Encoding> {}, ::std::move(__input),
__encoding, __error_handler, __actual_decode_state);
return __count_as_decoded_result(::std::move(__raw_result.input), __raw_result.count, __state,
__raw_result.error_code, __raw_result.error_count);
}
Expand Down
4 changes: 2 additions & 2 deletions include/ztd/text/decode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ namespace ztd { namespace text {
using _Output = ::ztd::span<_IntermediateValueType>;
using _Result = decltype(__encoding.decode_one(
::std::declval<_IntermediateInput>(), ::std::declval<_Output>(), __error_handler, __state));
using _WorkingInput = __span_reconstruct_t<decltype(::std::declval<_Result>().input),
decltype(::std::declval<_Result>().input)>;
using _ResultInput = decltype(::std::declval<_Result>().input);
using _WorkingInput = __span_reconstruct_t<_ResultInput, _ResultInput>;

static_assert(__txt_detail::__is_decode_lossless_or_deliberate_v<_Encoding, _ErrorHandler>,
ZTD_TEXT_LOSSY_DECODE_MESSAGE_I_);
Expand Down
4 changes: 2 additions & 2 deletions include/ztd/text/detail/span_reconstruct.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace ztd { namespace text {
::std::in_place_type<_UInputTag>, ::std::forward<_Input>(__input));
}
else if constexpr (::ztd::is_span_v<_UInput>) {
using _Ty = ::std::conditional_t<_Mutable, ::ztd::ranges::range_cv_value_type_t<_UInput>,
using _Ty = ::std::conditional_t<_Mutable, typename _UInput::element_type,
const typename _UInput::value_type>;
return ::ztd::span<_Ty, _UInput::extent>(__input);
}
Expand All @@ -87,7 +87,7 @@ namespace ztd { namespace text {
}
else {
if constexpr (ranges::is_range_contiguous_range_v<_CVInput> && ranges::is_sized_range_v<_CVInput>) {
using _Ty = ::ztd::ranges::range_cv_value_type_t<_CVInput>;
using _Ty = ::ztd::ranges::range_element_type_t<_CVInput>;
return ::ztd::ranges::reconstruct(
::std::in_place_type<::ztd::span<_Ty>>, ::std::forward<_Input>(__input));
}
Expand Down
8 changes: 7 additions & 1 deletion include/ztd/text/shift_jis_x0208.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,13 +422,19 @@ namespace ztd { namespace text {
}
};

template <typename _CodeUnit, typename _CodePoint>
//////
/// @brief A convenience alais that defaults `basic_shift_jis` to the x0208 version.
template <typename _CodeUnit, typename _CodePoint = unicode_code_point>
using basic_shift_jis = basic_shift_jis_x0208<_CodeUnit, _CodePoint>;

//////
/// @brief An instance of basic_shift_jis_x0208 for ease of use.
inline constexpr basic_shift_jis_x0208<char> shift_jis_x0208 = {};

//////
/// @brief A convenience alais that defaults `shift_jis` to the x0208 version.
using shift_jis_t = basic_shift_jis_x0208<char>;

//////
/// @brief An instance of basic_shift_jis for ease of use.
inline constexpr auto& shift_jis = shift_jis_x0208;
Expand Down

0 comments on commit c07fba7

Please sign in to comment.