Skip to content

Commit 71eeb36

Browse files
committed
Remove the broken use of alias CTAD from the transcoding views.
Fixes #193.
1 parent 7ae86c1 commit 71eeb36

File tree

5 files changed

+4
-201
lines changed

5 files changed

+4
-201
lines changed

include/boost/parser/detail/text/config.hpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,6 @@
1818
# define BOOST_PARSER_DETAIL_TEXT_USE_CONCEPTS 1
1919
#endif
2020

21-
// GCC 12 claims to support 201907L <= __cpp_deduction_guides, but does not.
22-
#if BOOST_PARSER_DETAIL_TEXT_USE_CONCEPTS && defined(__cpp_deduction_guides) && \
23-
201907L <= __cpp_deduction_guides && (!defined(__GNUC__) || 13 <= __GNUC__) && \
24-
!defined(_MSC_VER)
25-
#define BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD 1
26-
#else
27-
#define BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD 0
28-
#endif
29-
3021
#if BOOST_PARSER_USE_CONCEPTS
3122
namespace boost::parser::detail { namespace text { namespace detail {
3223
inline constexpr auto begin = std::ranges::begin;

include/boost/parser/detail/text/transcode_iterator_fwd.hpp

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -51,51 +51,6 @@ namespace boost::parser::detail { namespace text {
5151
#endif
5252
class utf_iterator;
5353

54-
#if BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD
55-
56-
template<
57-
utf8_iter I,
58-
std::sentinel_for<I> S = I,
59-
transcoding_error_handler ErrorHandler = use_replacement_character>
60-
using utf_8_to_16_iterator =
61-
utf_iterator<format::utf8, format::utf16, I, S, ErrorHandler>;
62-
template<
63-
utf16_iter I,
64-
std::sentinel_for<I> S = I,
65-
transcoding_error_handler ErrorHandler = use_replacement_character>
66-
using utf_16_to_8_iterator =
67-
utf_iterator<format::utf16, format::utf8, I, S, ErrorHandler>;
68-
69-
70-
template<
71-
utf8_iter I,
72-
std::sentinel_for<I> S = I,
73-
transcoding_error_handler ErrorHandler = use_replacement_character>
74-
using utf_8_to_32_iterator =
75-
utf_iterator<format::utf8, format::utf32, I, S, ErrorHandler>;
76-
template<
77-
utf32_iter I,
78-
std::sentinel_for<I> S = I,
79-
transcoding_error_handler ErrorHandler = use_replacement_character>
80-
using utf_32_to_8_iterator =
81-
utf_iterator<format::utf32, format::utf8, I, S, ErrorHandler>;
82-
83-
84-
template<
85-
utf16_iter I,
86-
std::sentinel_for<I> S = I,
87-
transcoding_error_handler ErrorHandler = use_replacement_character>
88-
using utf_16_to_32_iterator =
89-
utf_iterator<format::utf16, format::utf32, I, S, ErrorHandler>;
90-
template<
91-
utf32_iter I,
92-
std::sentinel_for<I> S = I,
93-
transcoding_error_handler ErrorHandler = use_replacement_character>
94-
using utf_32_to_16_iterator =
95-
utf_iterator<format::utf32, format::utf16, I, S, ErrorHandler>;
96-
97-
#endif
98-
9954
}}
10055

10156
#endif

include/boost/parser/detail/text/transcode_view.hpp

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,6 @@ namespace boost::parser::detail { namespace text {
266266
{ return y.end_ - x.it_; }
267267
};
268268

269-
#if BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD
270-
template<class R, auto F>
271-
project_view(R &&) -> project_view<std::views::all_t<R>, F>;
272-
#endif
273-
274269
namespace detail {
275270
#if BOOST_PARSER_DETAIL_TEXT_USE_CONCEPTS
276271
template<auto F>
@@ -293,11 +288,7 @@ namespace boost::parser::detail { namespace text {
293288
#endif
294289
[[nodiscard]] constexpr auto operator()(R && r) const
295290
{
296-
#if BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD
297-
return project_view_type(std::forward<R>(r));
298-
#else
299291
return project_view_type<R>(std::forward<R>(r));
300-
#endif
301292
}
302293
};
303294
}
@@ -309,17 +300,6 @@ namespace boost::parser::detail { namespace text {
309300
#endif
310301
constexpr detail::project_impl<F> project{};
311302

312-
#if BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD
313-
314-
template<class V>
315-
using char8_view = project_view<V, detail::cast_to_charn<char8_t>{}>;
316-
template<class V>
317-
using char16_view = project_view<V, detail::cast_to_charn<char16_t>{}>;
318-
template<class V>
319-
using char32_view = project_view<V, detail::cast_to_charn<char32_t>{}>;
320-
321-
#else
322-
323303
#if defined(__cpp_char8_t)
324304
#if BOOST_PARSER_DETAIL_TEXT_USE_CONCEPTS
325305
template<std::ranges::input_range V>
@@ -399,8 +379,6 @@ namespace boost::parser::detail { namespace text {
399379
char16_view(R &&) -> char16_view<detail::all_t<R>>;
400380
template<class R>
401381
char32_view(R &&) -> char32_view<detail::all_t<R>>;
402-
#endif
403-
404382
#endif
405383

406384
namespace detail {
@@ -610,20 +588,6 @@ namespace boost::parser::detail { namespace text {
610588
};
611589

612590

613-
#if BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD
614-
615-
template<format Format, class R>
616-
utf_view(R &&) -> utf_view<Format, std::views::all_t<R>>;
617-
618-
template<class V>
619-
using utf8_view = utf_view<format::utf8, V>;
620-
template<class V>
621-
using utf16_view = utf_view<format::utf16, V>;
622-
template<class V>
623-
using utf32_view = utf_view<format::utf32, V>;
624-
625-
#else
626-
627591
#if BOOST_PARSER_DETAIL_TEXT_USE_CONCEPTS
628592
template<utf_range V>
629593
requires std::ranges::view<V>
@@ -679,16 +643,12 @@ namespace boost::parser::detail { namespace text {
679643
{}
680644
};
681645

682-
#if !BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD
683646
template<class R>
684647
utf8_view(R &&) -> utf8_view<detail::all_t<R>>;
685648
template<class R>
686649
utf16_view(R &&) -> utf16_view<detail::all_t<R>>;
687650
template<class R>
688651
utf32_view(R &&) -> utf32_view<detail::all_t<R>>;
689-
#endif
690-
691-
#endif
692652

693653
#if defined(BOOST_TEXT_DOXYGEN)
694654

@@ -821,7 +781,6 @@ namespace std::ranges {
821781
inline constexpr bool enable_borrowed_range<boost::parser::detail::text::utf_view<Format, V>> =
822782
enable_borrowed_range<V>;
823783

824-
#if !BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD
825784
template<class V>
826785
inline constexpr bool enable_borrowed_range<boost::parser::detail::text::utf8_view<V>> =
827786
enable_borrowed_range<V>;
@@ -831,7 +790,6 @@ namespace std::ranges {
831790
template<class V>
832791
inline constexpr bool enable_borrowed_range<boost::parser::detail::text::utf32_view<V>> =
833792
enable_borrowed_range<V>;
834-
#endif
835793
}
836794

837795
#endif

include/boost/parser/transcode_view.hpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@ namespace boost::parser {
1313

1414
using format = detail::text::format;
1515

16-
#if BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD
17-
18-
template<class V>
19-
using utf8_view = detail::text::utf_view<format::utf8, V>;
20-
template<class V>
21-
using utf16_view = detail::text::utf_view<format::utf16, V>;
22-
template<class V>
23-
using utf32_view = detail::text::utf_view<format::utf32, V>;
24-
25-
#else
26-
2716
/** A view that produces UTF-8 from an given sequence of UTF.
2817
2918
\tparam V Constrained by `std::ranges::view<V>`. Additionally, the
@@ -103,8 +92,6 @@ namespace boost::parser {
10392
utf16_view(R &&) -> utf16_view<std::views::all_t<R>>;
10493
template<class R>
10594
utf32_view(R &&) -> utf32_view<std::views::all_t<R>>;
106-
#endif
107-
10895
#endif
10996

11097
/** A view adaptor that produces a `utf8_view` of the given view. */

test/transform_replace.cpp

Lines changed: 4 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -201,27 +201,13 @@ namespace detail_utf_rvalue_shim {
201201

202202
bp::detail::utf_rvalue_shim<std::u8string, decltype(f_u16str), attr_t>
203203
u8_u16_shim(f_u16str);
204-
#if BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD
205-
static_assert(std::is_same_v<
206-
decltype(u8_u16_shim(attr_t{})),
207-
bp::detail::text::utf_view<
208-
bp::detail::text::format::utf8,
209-
std::ranges::owning_view<std::u16string>> &>);
210-
#endif
211204
static_assert(bp::detail::transform_replacement_for<
212205
decltype(u8_u16_shim),
213206
std::u8string,
214207
decltype(ints_p.parser_)>);
215208

216209
bp::detail::utf_rvalue_shim<std::u8string, decltype(f_u16str_ref), attr_t>
217210
u8_u16_ref_shim(f_u16str_ref);
218-
#if BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD
219-
static_assert(std::is_same_v<
220-
decltype(u8_u16_ref_shim(attr_t{})),
221-
bp::detail::text::utf_view<
222-
bp::detail::text::format::utf8,
223-
std::ranges::ref_view<std::u16string>> &>);
224-
#endif
225211
static_assert(bp::detail::transform_replacement_for<
226212
decltype(u8_u16_ref_shim),
227213
std::u8string,
@@ -231,27 +217,13 @@ namespace detail_utf_rvalue_shim {
231217

232218
bp::detail::utf_rvalue_shim<std::u8string, decltype(f_u32str), attr_t>
233219
u8_u32_shim(f_u32str);
234-
#if BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD
235-
static_assert(std::is_same_v<
236-
decltype(u8_u32_shim(attr_t{})),
237-
bp::detail::text::utf_view<
238-
bp::detail::text::format::utf8,
239-
std::ranges::owning_view<std::u32string>> &>);
240-
#endif
241220
static_assert(bp::detail::transform_replacement_for<
242221
decltype(u8_u32_shim),
243222
std::u8string,
244223
decltype(ints_p.parser_)>);
245224

246225
bp::detail::utf_rvalue_shim<std::u8string, decltype(f_u32str_ref), attr_t>
247226
u8_u32_ref_shim(f_u32str_ref);
248-
#if BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD
249-
static_assert(std::is_same_v<
250-
decltype(u8_u32_ref_shim(attr_t{})),
251-
bp::detail::text::utf_view<
252-
bp::detail::text::format::utf8,
253-
std::ranges::ref_view<std::u32string>> &>);
254-
#endif
255227
static_assert(bp::detail::transform_replacement_for<
256228
decltype(u8_u32_ref_shim),
257229
std::u8string,
@@ -261,27 +233,13 @@ namespace detail_utf_rvalue_shim {
261233

262234
bp::detail::utf_rvalue_shim<std::u16string, decltype(f_u8str), attr_t>
263235
u16_u8_shim(f_u8str);
264-
#if BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD
265-
static_assert(std::is_same_v<
266-
decltype(u16_u8_shim(attr_t{})),
267-
bp::detail::text::utf_view<
268-
bp::detail::text::format::utf16,
269-
std::ranges::owning_view<std::u8string>> &>);
270-
#endif
271236
static_assert(bp::detail::transform_replacement_for<
272237
decltype(u16_u8_shim),
273238
std::u16string,
274239
decltype(ints_p.parser_)>);
275240

276241
bp::detail::utf_rvalue_shim<std::u16string, decltype(f_u8str_ref), attr_t>
277242
u16_u8_ref_shim(f_u8str_ref);
278-
#if BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD
279-
static_assert(std::is_same_v<
280-
decltype(u16_u8_ref_shim(attr_t{})),
281-
bp::detail::text::utf_view<
282-
bp::detail::text::format::utf16,
283-
std::ranges::ref_view<std::u8string const>> &>);
284-
#endif
285243
static_assert(bp::detail::transform_replacement_for<
286244
decltype(u16_u8_ref_shim),
287245
std::u16string,
@@ -291,27 +249,13 @@ namespace detail_utf_rvalue_shim {
291249

292250
bp::detail::utf_rvalue_shim<std::u32string, decltype(f_u8str), attr_t>
293251
u32_u8_shim(f_u8str);
294-
#if BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD
295-
static_assert(std::is_same_v<
296-
decltype(u32_u8_shim(attr_t{})),
297-
bp::detail::text::utf_view<
298-
bp::detail::text::format::utf32,
299-
std::ranges::owning_view<std::u8string>> &>);
300-
#endif
301252
static_assert(bp::detail::transform_replacement_for<
302253
decltype(u32_u8_shim),
303254
std::u32string,
304255
decltype(ints_p.parser_)>);
305256

306257
bp::detail::utf_rvalue_shim<std::u32string, decltype(f_u8str_ref), attr_t>
307258
u32_u8_ref_shim(f_u8str_ref);
308-
#if BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD
309-
static_assert(std::is_same_v<
310-
decltype(u32_u8_ref_shim(attr_t{})),
311-
bp::detail::text::utf_view<
312-
bp::detail::text::format::utf32,
313-
std::ranges::ref_view<std::u8string const>> &>);
314-
#endif
315259
static_assert(bp::detail::transform_replacement_for<
316260
decltype(u32_u8_ref_shim),
317261
std::u32string,
@@ -341,15 +285,7 @@ namespace detail_utf_rvalue_shim {
341285

342286
bp::detail::utf_rvalue_shim<std::u16string, decltype(f_u32str), attr_t>
343287
u16_u32_shim(f_u32str);
344-
#if BOOST_PARSER_USE_CONCEPTS
345-
#if BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD
346-
static_assert(std::is_same_v<
347-
decltype(u16_u32_shim(attr_t{})),
348-
bp::detail::text::utf_view<
349-
bp::detail::text::format::utf16,
350-
std::ranges::owning_view<std::u32string>> &>);
351-
#endif
352-
#else
288+
#if !BOOST_PARSER_USE_CONCEPTS
353289
static_assert(
354290
std::is_same_v<
355291
decltype(u16_u32_shim(attr_t{})),
@@ -363,15 +299,7 @@ namespace detail_utf_rvalue_shim {
363299

364300
bp::detail::utf_rvalue_shim<std::u16string, decltype(f_u32str_ref), attr_t>
365301
u16_u32_ref_shim(f_u32str_ref);
366-
#if BOOST_PARSER_USE_CONCEPTS
367-
#if BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD
368-
static_assert(std::is_same_v<
369-
decltype(u16_u32_ref_shim(attr_t{})),
370-
bp::detail::text::utf_view<
371-
bp::detail::text::format::utf16,
372-
std::ranges::ref_view<std::u32string>> &>);
373-
#endif
374-
#else
302+
#if !BOOST_PARSER_USE_CONCEPTS
375303
static_assert(std::is_same_v<
376304
decltype(u16_u32_ref_shim(attr_t{})),
377305
bp::detail::text::utf16_view<
@@ -406,15 +334,7 @@ namespace detail_utf_rvalue_shim {
406334

407335
bp::detail::utf_rvalue_shim<std::u32string, decltype(f_u16str), attr_t>
408336
u32_u16_shim(f_u16str);
409-
#if BOOST_PARSER_USE_CONCEPTS
410-
#if BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD
411-
static_assert(std::is_same_v<
412-
decltype(u32_u16_shim(attr_t{})),
413-
bp::detail::text::utf_view<
414-
bp::detail::text::format::utf32,
415-
std::ranges::owning_view<std::u16string>> &>);
416-
#endif
417-
#else
337+
#if !BOOST_PARSER_USE_CONCEPTS
418338
static_assert(
419339
std::is_same_v<
420340
decltype(u32_u16_shim(attr_t{})),
@@ -428,15 +348,7 @@ namespace detail_utf_rvalue_shim {
428348

429349
bp::detail::utf_rvalue_shim<std::u32string, decltype(f_u16str_ref), attr_t>
430350
u32_u16_ref_shim(f_u16str_ref);
431-
#if BOOST_PARSER_USE_CONCEPTS
432-
#if BOOST_PARSER_DETAIL_TEXT_USE_ALIAS_CTAD
433-
static_assert(std::is_same_v<
434-
decltype(u32_u16_ref_shim(attr_t{})),
435-
bp::detail::text::utf_view<
436-
bp::detail::text::format::utf32,
437-
std::ranges::ref_view<std::u16string>> &>);
438-
#endif
439-
#else
351+
#if !BOOST_PARSER_USE_CONCEPTS
440352
static_assert(std::is_same_v<
441353
decltype(u32_u16_ref_shim(attr_t{})),
442354
bp::detail::text::utf32_view<

0 commit comments

Comments
 (0)