From 5a4ba1eb2201f9ebf7dea66090a80791b741ba41 Mon Sep 17 00:00:00 2001 From: Nana Sakisaka <1901813+saki7@users.noreply.github.com> Date: Fri, 25 Sep 2026 03:22:11 +0900 Subject: [PATCH 1/2] Reorganize trait headers --- include/iris/x4/attribute/value.hpp | 6 +++--- include/iris/x4/char/char.hpp | 2 +- include/iris/x4/char/char_class.hpp | 4 +--- include/iris/x4/char/char_parser.hpp | 3 ++- include/iris/x4/char/char_set.hpp | 3 ++- include/iris/x4/char_string_literal.hpp | 2 +- include/iris/x4/core/container_appender.hpp | 9 +++++---- include/iris/x4/core/detail/parse_alternative.hpp | 13 ++++++------- .../iris/x4/core/detail/parse_into_container.hpp | 2 +- include/iris/x4/core/detail/parse_sequence.hpp | 10 +++++----- include/iris/x4/core/list_like_parser.hpp | 8 ++++---- include/iris/x4/core/move_to.hpp | 7 +++---- include/iris/x4/core/parser_traits.hpp | 2 +- .../x4/{ => core}/traits/attribute_category.hpp | 10 ++++++---- include/iris/x4/{ => core}/traits/can_hold.hpp | 8 +++++--- .../x4/{ => core}/traits/char_encoding_traits.hpp | 6 ++++-- include/iris/x4/core/{ => traits}/char_traits.hpp | 0 .../iris/x4/{ => core}/traits/numeric_traits.hpp | 6 ++++-- .../iris/x4/{ => core}/traits/optional_traits.hpp | 6 +++--- .../x4/{ => core}/traits/transform_attribute.hpp | 6 ++++-- include/iris/x4/{ => core}/traits/tuple_traits.hpp | 6 ++++-- .../iris/x4/{ => core}/traits/variant_traits.hpp | 8 +++----- include/iris/x4/debug/print_attribute.hpp | 5 ++--- include/iris/x4/numeric/bool.hpp | 6 +++--- include/iris/x4/numeric/real.hpp | 8 ++++---- include/iris/x4/numeric/utils/extract_int.hpp | 6 +++--- include/iris/x4/numeric/utils/pow10.hpp | 2 +- include/iris/x4/operator/optional.hpp | 12 ++++++------ include/iris/x4/parse.hpp | 2 +- include/iris/x4/parse_result.hpp | 2 +- include/iris/x4/rule.hpp | 4 ++-- include/iris/x4/string/detail/string_parse.hpp | 7 ++++--- include/iris/x4/traits/attribute_traits.hpp | 8 ++++---- test/x4/substitution.cpp | 6 +++--- test/x4/unused.cpp | 5 +++-- 35 files changed, 105 insertions(+), 95 deletions(-) rename include/iris/x4/{ => core}/traits/attribute_category.hpp (91%) rename include/iris/x4/{ => core}/traits/can_hold.hpp (94%) rename include/iris/x4/{ => core}/traits/char_encoding_traits.hpp (93%) rename include/iris/x4/core/{ => traits}/char_traits.hpp (100%) rename include/iris/x4/{ => core}/traits/numeric_traits.hpp (94%) rename include/iris/x4/{ => core}/traits/optional_traits.hpp (91%) rename include/iris/x4/{ => core}/traits/transform_attribute.hpp (96%) rename include/iris/x4/{ => core}/traits/tuple_traits.hpp (94%) rename include/iris/x4/{ => core}/traits/variant_traits.hpp (93%) diff --git a/include/iris/x4/attribute/value.hpp b/include/iris/x4/attribute/value.hpp index 2fb95e84b..90366dd26 100644 --- a/include/iris/x4/attribute/value.hpp +++ b/include/iris/x4/attribute/value.hpp @@ -12,11 +12,11 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ +#include +#include + #include #include -#include - -#include #include #include diff --git a/include/iris/x4/char/char.hpp b/include/iris/x4/char/char.hpp index ad69154f0..df87c76b8 100644 --- a/include/iris/x4/char/char.hpp +++ b/include/iris/x4/char/char.hpp @@ -13,7 +13,7 @@ #include // IWYU pragma: export #include // IWYU pragma: export -#include +#include namespace iris::x4 { diff --git a/include/iris/x4/char/char_class.hpp b/include/iris/x4/char/char_class.hpp index b87b9b9b9..d7743e2eb 100644 --- a/include/iris/x4/char/char_class.hpp +++ b/include/iris/x4/char/char_class.hpp @@ -11,7 +11,7 @@ ==============================================================================*/ #include -#include +#include #include #include @@ -19,8 +19,6 @@ #include -#include - #include #ifndef IRIS_X4_NO_STANDARD_WIDE diff --git a/include/iris/x4/char/char_parser.hpp b/include/iris/x4/char/char_parser.hpp index 01fa3fa6b..c07e8b0a8 100644 --- a/include/iris/x4/char/char_parser.hpp +++ b/include/iris/x4/char/char_parser.hpp @@ -13,7 +13,8 @@ #include #include #include -#include + +#include #include #include diff --git a/include/iris/x4/char/char_set.hpp b/include/iris/x4/char/char_set.hpp index 07d636e18..d3406123f 100644 --- a/include/iris/x4/char/char_set.hpp +++ b/include/iris/x4/char/char_set.hpp @@ -13,7 +13,8 @@ #include #include #include -#include + +#include #include diff --git a/include/iris/x4/char_string_literal.hpp b/include/iris/x4/char_string_literal.hpp index d57ce292a..cda055b01 100644 --- a/include/iris/x4/char_string_literal.hpp +++ b/include/iris/x4/char_string_literal.hpp @@ -11,9 +11,9 @@ #include #include +#include #include #include -#include #include diff --git a/include/iris/x4/core/container_appender.hpp b/include/iris/x4/core/container_appender.hpp index 0b45adbe9..cc606a26f 100644 --- a/include/iris/x4/core/container_appender.hpp +++ b/include/iris/x4/core/container_appender.hpp @@ -1,4 +1,4 @@ -#ifndef IRIS_ZZ_X4_CORE_CONTAINER_APPENDER_HPP +#ifndef IRIS_ZZ_X4_CORE_CONTAINER_APPENDER_HPP #define IRIS_ZZ_X4_CORE_CONTAINER_APPENDER_HPP /*============================================================================= @@ -9,11 +9,12 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ -#include -#include +#include // IWYU pragma: keep #include -#include +#include + +#include #include #include diff --git a/include/iris/x4/core/detail/parse_alternative.hpp b/include/iris/x4/core/detail/parse_alternative.hpp index bfcd3f55e..e3d434392 100644 --- a/include/iris/x4/core/detail/parse_alternative.hpp +++ b/include/iris/x4/core/detail/parse_alternative.hpp @@ -12,19 +12,18 @@ #include // IWYU pragma: keep +#include +#include +#include +#include + +#include #include #include #include #include #include - -#include -#include -#include -#include - #include -#include #include // IWYU pragma: keep diff --git a/include/iris/x4/core/detail/parse_into_container.hpp b/include/iris/x4/core/detail/parse_into_container.hpp index eb6cb7bf6..6b7cd56c9 100644 --- a/include/iris/x4/core/detail/parse_into_container.hpp +++ b/include/iris/x4/core/detail/parse_into_container.hpp @@ -16,7 +16,7 @@ #include #include -#include +#include #include diff --git a/include/iris/x4/core/detail/parse_sequence.hpp b/include/iris/x4/core/detail/parse_sequence.hpp index 2ee8de618..331aff7ee 100644 --- a/include/iris/x4/core/detail/parse_sequence.hpp +++ b/include/iris/x4/core/detail/parse_sequence.hpp @@ -12,16 +12,16 @@ #include +#include +#include +#include +#include + #include #include #include #include -#include -#include -#include -#include - #include #include diff --git a/include/iris/x4/core/list_like_parser.hpp b/include/iris/x4/core/list_like_parser.hpp index d5cb74043..26036c64d 100644 --- a/include/iris/x4/core/list_like_parser.hpp +++ b/include/iris/x4/core/list_like_parser.hpp @@ -1,13 +1,13 @@ #ifndef IRIS_X4_CORE_LIST_LIKE_PARSER_HPP #define IRIS_X4_CORE_LIST_LIKE_PARSER_HPP -#include +#include // IWYU pragma: keep -#include -#include +#include +#include #include // export -#include // export +#include // IWYU pragma: export #include #include diff --git a/include/iris/x4/core/move_to.hpp b/include/iris/x4/core/move_to.hpp index 0e3a1f25c..aceca3897 100644 --- a/include/iris/x4/core/move_to.hpp +++ b/include/iris/x4/core/move_to.hpp @@ -13,10 +13,9 @@ #include // IWYU pragma: keep -#include - -#include -#include +#include +#include +#include #include // IWYU pragma: keep #include diff --git a/include/iris/x4/core/parser_traits.hpp b/include/iris/x4/core/parser_traits.hpp index 9c38f741e..2aac32c3d 100644 --- a/include/iris/x4/core/parser_traits.hpp +++ b/include/iris/x4/core/parser_traits.hpp @@ -11,7 +11,7 @@ #include // IWYU pragma: keep -#include +#include #include #include diff --git a/include/iris/x4/traits/attribute_category.hpp b/include/iris/x4/core/traits/attribute_category.hpp similarity index 91% rename from include/iris/x4/traits/attribute_category.hpp rename to include/iris/x4/core/traits/attribute_category.hpp index 10049137c..524e8d821 100644 --- a/include/iris/x4/traits/attribute_category.hpp +++ b/include/iris/x4/core/traits/attribute_category.hpp @@ -1,5 +1,5 @@ -#ifndef IRIS_ZZ_X4_TRAITS_ATTRIBUTE_CATEGORY_HPP -#define IRIS_ZZ_X4_TRAITS_ATTRIBUTE_CATEGORY_HPP +#ifndef IRIS_ZZ_X4_CORE_TRAITS_ATTRIBUTE_CATEGORY_HPP +#define IRIS_ZZ_X4_CORE_TRAITS_ATTRIBUTE_CATEGORY_HPP /*============================================================================= Copyright (c) 2001-2014 Joel de Guzman @@ -10,9 +10,11 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ -#include +#include // IWYU pragma: keep + #include -#include +#include +#include #include diff --git a/include/iris/x4/traits/can_hold.hpp b/include/iris/x4/core/traits/can_hold.hpp similarity index 94% rename from include/iris/x4/traits/can_hold.hpp rename to include/iris/x4/core/traits/can_hold.hpp index 469046c7f..9e8b79c89 100644 --- a/include/iris/x4/traits/can_hold.hpp +++ b/include/iris/x4/core/traits/can_hold.hpp @@ -1,5 +1,5 @@ -#ifndef IRIS_X4_TRAITS_CAN_HOLD_HPP -#define IRIS_X4_TRAITS_CAN_HOLD_HPP +#ifndef IRIS_ZZ_X4_CORE_TRAITS_CAN_HOLD_HPP +#define IRIS_ZZ_X4_CORE_TRAITS_CAN_HOLD_HPP /*============================================================================= Copyright (c) 2001-2014 Joel de Guzman @@ -10,8 +10,10 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ +#include // IWYU pragma: keep + #include -#include +#include #include diff --git a/include/iris/x4/traits/char_encoding_traits.hpp b/include/iris/x4/core/traits/char_encoding_traits.hpp similarity index 93% rename from include/iris/x4/traits/char_encoding_traits.hpp rename to include/iris/x4/core/traits/char_encoding_traits.hpp index cc8ac0adc..211bbb7fe 100644 --- a/include/iris/x4/traits/char_encoding_traits.hpp +++ b/include/iris/x4/core/traits/char_encoding_traits.hpp @@ -1,5 +1,5 @@ -#ifndef IRIS_ZZ_X4_TRAITS_CHAR_ENCODING_TRAITS_HPP -#define IRIS_ZZ_X4_TRAITS_CHAR_ENCODING_TRAITS_HPP +#ifndef IRIS_ZZ_X4_CORE_TRAITS_CHAR_ENCODING_TRAITS_HPP +#define IRIS_ZZ_X4_CORE_TRAITS_CHAR_ENCODING_TRAITS_HPP /*============================================================================= Copyright (c) 2025 Nana Sakisaka @@ -9,6 +9,8 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ +#include // IWYU pragma: keep + #include #ifndef IRIS_X4_NO_STANDARD_WIDE diff --git a/include/iris/x4/core/char_traits.hpp b/include/iris/x4/core/traits/char_traits.hpp similarity index 100% rename from include/iris/x4/core/char_traits.hpp rename to include/iris/x4/core/traits/char_traits.hpp diff --git a/include/iris/x4/traits/numeric_traits.hpp b/include/iris/x4/core/traits/numeric_traits.hpp similarity index 94% rename from include/iris/x4/traits/numeric_traits.hpp rename to include/iris/x4/core/traits/numeric_traits.hpp index 141e081cc..65e93364a 100644 --- a/include/iris/x4/traits/numeric_traits.hpp +++ b/include/iris/x4/core/traits/numeric_traits.hpp @@ -1,5 +1,5 @@ -#ifndef IRIS_ZZ_X4_TRAITS_NUMERIC_TRAITS_HPP -#define IRIS_ZZ_X4_TRAITS_NUMERIC_TRAITS_HPP +#ifndef IRIS_ZZ_X4_CORE_TRAITS_NUMERIC_TRAITS_HPP +#define IRIS_ZZ_X4_CORE_TRAITS_NUMERIC_TRAITS_HPP /*============================================================================= Copyright (c) 2001-2011 Hartmut Kaiser @@ -10,6 +10,8 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ +#include // IWYU pragma: keep + #include #include #include diff --git a/include/iris/x4/traits/optional_traits.hpp b/include/iris/x4/core/traits/optional_traits.hpp similarity index 91% rename from include/iris/x4/traits/optional_traits.hpp rename to include/iris/x4/core/traits/optional_traits.hpp index 6d4fde023..6c76fa874 100644 --- a/include/iris/x4/traits/optional_traits.hpp +++ b/include/iris/x4/core/traits/optional_traits.hpp @@ -1,5 +1,5 @@ -#ifndef IRIS_ZZ_X4_TRAITS_OPTIONAL_TRAITS_HPP -#define IRIS_ZZ_X4_TRAITS_OPTIONAL_TRAITS_HPP +#ifndef IRIS_ZZ_X4_CORE_TRAITS_OPTIONAL_TRAITS_HPP +#define IRIS_ZZ_X4_CORE_TRAITS_OPTIONAL_TRAITS_HPP /*============================================================================= Copyright (c) 2001-2014 Joel de Guzman @@ -11,7 +11,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ -#include +#include // IWYU pragma: keep #include #include diff --git a/include/iris/x4/traits/transform_attribute.hpp b/include/iris/x4/core/traits/transform_attribute.hpp similarity index 96% rename from include/iris/x4/traits/transform_attribute.hpp rename to include/iris/x4/core/traits/transform_attribute.hpp index 6afa29a36..866fd5933 100644 --- a/include/iris/x4/traits/transform_attribute.hpp +++ b/include/iris/x4/core/traits/transform_attribute.hpp @@ -1,5 +1,5 @@ -#ifndef IRIS_ZZ_X4_TRAITS_TRANSFORM_ATTRIBUTE_HPP -#define IRIS_ZZ_X4_TRAITS_TRANSFORM_ATTRIBUTE_HPP +#ifndef IRIS_ZZ_X4_CORE_TRAITS_TRANSFORM_ATTRIBUTE_HPP +#define IRIS_ZZ_X4_CORE_TRAITS_TRANSFORM_ATTRIBUTE_HPP /*============================================================================= Copyright (c) 2001-2014 Joel de Guzman @@ -11,6 +11,8 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ +#include // IWYU pragma: keep + #include #include diff --git a/include/iris/x4/traits/tuple_traits.hpp b/include/iris/x4/core/traits/tuple_traits.hpp similarity index 94% rename from include/iris/x4/traits/tuple_traits.hpp rename to include/iris/x4/core/traits/tuple_traits.hpp index 0771aa886..805c65ef7 100644 --- a/include/iris/x4/traits/tuple_traits.hpp +++ b/include/iris/x4/core/traits/tuple_traits.hpp @@ -1,5 +1,5 @@ -#ifndef IRIS_ZZ_X4_TRAITS_TUPLE_TRAITS_HPP -#define IRIS_ZZ_X4_TRAITS_TUPLE_TRAITS_HPP +#ifndef IRIS_ZZ_X4_CORE_TRAITS_TUPLE_TRAITS_HPP +#define IRIS_ZZ_X4_CORE_TRAITS_TUPLE_TRAITS_HPP /*============================================================================= Copyright (c) 2001-2014 Joel de Guzman @@ -10,6 +10,8 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ================================================_==============================*/ +#include // IWYU pragma: keep + #include #include diff --git a/include/iris/x4/traits/variant_traits.hpp b/include/iris/x4/core/traits/variant_traits.hpp similarity index 93% rename from include/iris/x4/traits/variant_traits.hpp rename to include/iris/x4/core/traits/variant_traits.hpp index 240444bfa..bac6380c5 100644 --- a/include/iris/x4/traits/variant_traits.hpp +++ b/include/iris/x4/core/traits/variant_traits.hpp @@ -1,5 +1,5 @@ -#ifndef IRIS_ZZ_X4_TRAITS_VARIANT_TRAITS_HPP -#define IRIS_ZZ_X4_TRAITS_VARIANT_TRAITS_HPP +#ifndef IRIS_ZZ_X4_CORE_TRAITS_VARIANT_TRAITS_HPP +#define IRIS_ZZ_X4_CORE_TRAITS_VARIANT_TRAITS_HPP /*============================================================================= Copyright (c) 2001-2014 Joel de Guzman @@ -12,15 +12,13 @@ #include // IWYU pragma: keep -#include +#include #include #include #include -// TODO: move this entire header to core (we should not support customizing variant traits) - namespace iris::x4::traits { template diff --git a/include/iris/x4/debug/print_attribute.hpp b/include/iris/x4/debug/print_attribute.hpp index 738033e3a..7e4d954b6 100644 --- a/include/iris/x4/debug/print_attribute.hpp +++ b/include/iris/x4/debug/print_attribute.hpp @@ -11,11 +11,10 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ================================================_==============================*/ -#include - #include -#include +#include +#include #include #include diff --git a/include/iris/x4/numeric/bool.hpp b/include/iris/x4/numeric/bool.hpp index 85b611a69..8c6df2eb7 100644 --- a/include/iris/x4/numeric/bool.hpp +++ b/include/iris/x4/numeric/bool.hpp @@ -11,14 +11,14 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ +#include +#include + #include #include #include #include -#include - -#include #include #include diff --git a/include/iris/x4/numeric/real.hpp b/include/iris/x4/numeric/real.hpp index 57b94a683..28fe5cb3b 100644 --- a/include/iris/x4/numeric/real.hpp +++ b/include/iris/x4/numeric/real.hpp @@ -11,12 +11,12 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ -#include -#include - #include #include -#include + +#include +#include +#include #include diff --git a/include/iris/x4/numeric/utils/extract_int.hpp b/include/iris/x4/numeric/utils/extract_int.hpp index 57eba19d7..15779a249 100644 --- a/include/iris/x4/numeric/utils/extract_int.hpp +++ b/include/iris/x4/numeric/utils/extract_int.hpp @@ -14,12 +14,12 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ +#include +#include + #include #include -#include -#include - #include #include #include diff --git a/include/iris/x4/numeric/utils/pow10.hpp b/include/iris/x4/numeric/utils/pow10.hpp index aca8afe77..d871a918d 100644 --- a/include/iris/x4/numeric/utils/pow10.hpp +++ b/include/iris/x4/numeric/utils/pow10.hpp @@ -11,8 +11,8 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ +#include #include -#include #include diff --git a/include/iris/x4/operator/optional.hpp b/include/iris/x4/operator/optional.hpp index 096f06c27..fb693c777 100644 --- a/include/iris/x4/operator/optional.hpp +++ b/include/iris/x4/operator/optional.hpp @@ -12,16 +12,16 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ +#include +#include +#include +#include + +#include #include #include -#include #include -#include -#include -#include -#include - #include #include #include diff --git a/include/iris/x4/parse.hpp b/include/iris/x4/parse.hpp index e24e360de..6922fa268 100644 --- a/include/iris/x4/parse.hpp +++ b/include/iris/x4/parse.hpp @@ -17,9 +17,9 @@ #include #include #include -#include #include +#include #include // for builtin skipper diff --git a/include/iris/x4/parse_result.hpp b/include/iris/x4/parse_result.hpp index b13eae6ce..0cbcbef1b 100644 --- a/include/iris/x4/parse_result.hpp +++ b/include/iris/x4/parse_result.hpp @@ -14,8 +14,8 @@ #include // IWYU pragma: keep +#include #include -#include #include #include diff --git a/include/iris/x4/rule.hpp b/include/iris/x4/rule.hpp index d5e92ce64..aa5819e74 100644 --- a/include/iris/x4/rule.hpp +++ b/include/iris/x4/rule.hpp @@ -13,6 +13,8 @@ #include // IWYU pragma: keep +#include + #include #include #include @@ -20,8 +22,6 @@ #include #include -#include - #include #include diff --git a/include/iris/x4/string/detail/string_parse.hpp b/include/iris/x4/string/detail/string_parse.hpp index a82dcc36e..16d966748 100644 --- a/include/iris/x4/string/detail/string_parse.hpp +++ b/include/iris/x4/string/detail/string_parse.hpp @@ -10,10 +10,11 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ -#include -#include -#include #include +#include +#include + +#include #include #include diff --git a/include/iris/x4/traits/attribute_traits.hpp b/include/iris/x4/traits/attribute_traits.hpp index 9b322abae..e7c39f250 100644 --- a/include/iris/x4/traits/attribute_traits.hpp +++ b/include/iris/x4/traits/attribute_traits.hpp @@ -8,13 +8,13 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ +#include +#include +#include + #include #include -#include -#include -#include - #include #include // IWYU pragma: keep diff --git a/test/x4/substitution.cpp b/test/x4/substitution.cpp index 5d8d24aac..4d55981ae 100644 --- a/test/x4/substitution.cpp +++ b/test/x4/substitution.cpp @@ -1,9 +1,9 @@ #include "iris_x4_test.hpp" -#include +#include +#include -#include -#include +#include #include diff --git a/test/x4/unused.cpp b/test/x4/unused.cpp index 609d01d9d..1cf1ef829 100644 --- a/test/x4/unused.cpp +++ b/test/x4/unused.cpp @@ -9,11 +9,12 @@ #include "iris_x4_test.hpp" -#include -#include #include #include +#include +#include + #include #include From 6d2c24ebe8cbad65c8d6a911919757b8423b11d5 Mon Sep 17 00:00:00 2001 From: Nana Sakisaka <1901813+saki7@users.noreply.github.com> Date: Fri, 25 Sep 2026 03:40:14 +0900 Subject: [PATCH 2/2] Change namespace of core traits --- include/iris/x4/attribute/value.hpp | 4 +- include/iris/x4/char/char.hpp | 2 +- include/iris/x4/char/char_class.hpp | 2 +- include/iris/x4/char_string_literal.hpp | 26 ++++---- include/iris/x4/core/container_appender.hpp | 26 ++++---- .../iris/x4/core/detail/parse_alternative.hpp | 8 +-- .../x4/core/detail/parse_into_container.hpp | 12 ++-- .../iris/x4/core/detail/parse_sequence.hpp | 10 +-- include/iris/x4/core/list_like_parser.hpp | 14 ++--- include/iris/x4/core/move_to.hpp | 44 ++++++------- include/iris/x4/core/parser_traits.hpp | 2 +- .../x4/core/traits/attribute_category.hpp | 63 ++++++++++--------- include/iris/x4/core/traits/can_hold.hpp | 12 ++-- .../x4/core/traits/char_encoding_traits.hpp | 4 +- .../iris/x4/core/traits/numeric_traits.hpp | 4 +- .../iris/x4/core/traits/optional_traits.hpp | 7 +-- .../x4/core/traits/transform_attribute.hpp | 4 +- include/iris/x4/core/traits/tuple_traits.hpp | 32 +++++----- .../iris/x4/core/traits/variant_traits.hpp | 12 ++-- include/iris/x4/debug/print_attribute.hpp | 10 +-- include/iris/x4/directive/repeat.hpp | 4 +- include/iris/x4/numeric/bool.hpp | 16 ++--- include/iris/x4/numeric/real.hpp | 8 +-- include/iris/x4/numeric/utils/extract_int.hpp | 16 ++--- .../iris/x4/numeric/utils/extract_real.hpp | 8 +-- include/iris/x4/numeric/utils/pow10.hpp | 4 +- include/iris/x4/operator/delimited_list.hpp | 2 +- include/iris/x4/operator/kleene.hpp | 2 +- include/iris/x4/operator/optional.hpp | 8 +-- include/iris/x4/operator/plus.hpp | 2 +- include/iris/x4/rule.hpp | 4 +- .../iris/x4/string/detail/string_parse.hpp | 8 +-- include/iris/x4/traits/attribute_traits.hpp | 16 ++--- test/x4/alternative.cpp | 4 +- test/x4/char.cpp | 4 +- test/x4/optional.cpp | 2 +- test/x4/partial_success.cpp | 8 +-- test/x4/sequence.cpp | 2 +- test/x4/substitution.cpp | 2 +- test/x4/unused.cpp | 20 +++--- 40 files changed, 217 insertions(+), 221 deletions(-) diff --git a/include/iris/x4/attribute/value.hpp b/include/iris/x4/attribute/value.hpp index 90366dd26..e5a0b07c3 100644 --- a/include/iris/x4/attribute/value.hpp +++ b/include/iris/x4/attribute/value.hpp @@ -93,7 +93,7 @@ struct fixed_value_parser : parser> } template Se, class Context, X4NonUnusedAttribute ContainerAttr> - requires traits::CategorizedAttr + requires CategorizedAttr [[nodiscard]] static constexpr bool parse(It&, Se const&, Context const&, ContainerAttr& exposed_attr) noexcept { @@ -102,7 +102,7 @@ struct fixed_value_parser : parser> } template Se, class Context, X4NonUnusedAttribute Attr> - requires (!traits::CategorizedAttr) + requires (!CategorizedAttr) [[nodiscard]] static constexpr bool parse(It&, Se const&, Context const&, Attr& exposed_attr) noexcept(noexcept(exposed_attr = Attr{})) diff --git a/include/iris/x4/char/char.hpp b/include/iris/x4/char/char.hpp index df87c76b8..8ddfe0d52 100644 --- a/include/iris/x4/char/char.hpp +++ b/include/iris/x4/char/char.hpp @@ -20,7 +20,7 @@ namespace iris::x4 { namespace detail { template -struct any_char_fn : any_char> +struct any_char_fn : any_char> {}; } // detail diff --git a/include/iris/x4/char/char_class.hpp b/include/iris/x4/char/char_class.hpp index d7743e2eb..8740300e6 100644 --- a/include/iris/x4/char/char_class.hpp +++ b/include/iris/x4/char/char_class.hpp @@ -184,7 +184,7 @@ constexpr void builtin_skip_over(It& first, Se const& last) noexcept using CharT = std::remove_cvref_t>; static_assert(CharLike); - using Encoding = traits::char_encoding_for; + using Encoding = char_encoding_for; using Parser = char_class_parser; while (first != last && Parser::test(static_cast(*first))) { diff --git a/include/iris/x4/char_string_literal.hpp b/include/iris/x4/char_string_literal.hpp index cda055b01..bb686f39c 100644 --- a/include/iris/x4/char_string_literal.hpp +++ b/include/iris/x4/char_string_literal.hpp @@ -41,7 +41,7 @@ struct char_parser_fn { template [[nodiscard]] static constexpr literal_char< - traits::char_encoding_for, + char_encoding_for, typename AttrSelectorTT::type > operator()(CharT ch) noexcept @@ -55,7 +55,7 @@ struct char_array_parser_fn { template [[nodiscard]] static constexpr literal_char< - traits::char_encoding_for, + char_encoding_for, typename AttrSelectorTT::type > operator()(CharT const (&str)[2]) noexcept @@ -66,7 +66,7 @@ struct char_array_parser_fn template [[nodiscard]] static constexpr literal_string< std::array, - traits::char_encoding_for, + char_encoding_for, typename AttrSelectorTT>::type > operator()(CharT const (&str)[N]) noexcept @@ -80,7 +80,7 @@ struct char_array_parser_fn template [[nodiscard]] static constexpr literal_string< std::basic_string_view, - traits::char_encoding_for, + char_encoding_for, typename AttrSelectorTT>::type > operator()(CharT const (&str)[N]) noexcept @@ -97,14 +97,14 @@ struct char_array_parser_fn template [[nodiscard]] static constexpr literal_string< std::array, - traits::char_encoding_for, + char_encoding_for, std::basic_string > operator()(CharT const (&str)[2]) noexcept { return literal_string< std::array, - traits::char_encoding_for, + char_encoding_for, std::basic_string >{std::array{str[0]}}; } @@ -112,7 +112,7 @@ struct char_array_parser_fn template [[nodiscard]] static constexpr literal_string< std::array, - traits::char_encoding_for, + char_encoding_for, std::basic_string > operator()(CharT const (&str)[N]) noexcept @@ -126,7 +126,7 @@ struct char_array_parser_fn template [[nodiscard]] static constexpr literal_string< std::basic_string_view, - traits::char_encoding_for, + char_encoding_for, std::basic_string > operator()(CharT const (&str)[N]) noexcept @@ -143,7 +143,7 @@ struct char_array_parser_fn // template // [[nodiscard]] static constexpr literal_string< // std::basic_string_view, -// traits::char_encoding_for, +// char_encoding_for, // typename AttrSelectorTT>::type // > // operator()(CharT const* s) noexcept @@ -159,14 +159,14 @@ struct string_parser_fn requires is_ttp_specialization_of_v, std::basic_string> [[nodiscard]] static constexpr literal_string< std::basic_string>, - traits::char_encoding_for>, + char_encoding_for>, typename AttrSelectorTT>>::type > operator()(StringLikeT&& str) noexcept(std::is_nothrow_constructible_v< literal_string< std::basic_string>, - traits::char_encoding_for>, + char_encoding_for>, typename AttrSelectorTT>>::type >, StringLikeT @@ -183,14 +183,14 @@ struct string_view_parser_fn requires is_ttp_specialization_of_v, std::basic_string_view> [[nodiscard]] static constexpr literal_string< std::basic_string_view>, - traits::char_encoding_for>, + char_encoding_for>, typename AttrSelectorTT>>::type > operator()(StringLikeT&& str) noexcept(std::is_nothrow_constructible_v< literal_string< std::basic_string_view>, - traits::char_encoding_for>, + char_encoding_for>, typename AttrSelectorTT>>::type >, StringLikeT diff --git a/include/iris/x4/core/container_appender.hpp b/include/iris/x4/core/container_appender.hpp index cc606a26f..3ea30861a 100644 --- a/include/iris/x4/core/container_appender.hpp +++ b/include/iris/x4/core/container_appender.hpp @@ -142,19 +142,6 @@ make_container_appender(ContainerAttr& appender) noexcept return appender; } -namespace traits { - -template -struct append_container> -{ - template Se> - static constexpr void call(container_appender& appender, It first, Se last) - noexcept(noexcept(traits::append(appender.container, std::move(first), std::move(last)))) - { - traits::append(appender.container, std::move(first), std::move(last)); - } -}; - template struct transform_attribute> { @@ -171,6 +158,19 @@ struct transform_attribute> } }; +namespace traits { + +template +struct append_container> +{ + template Se> + static constexpr void call(container_appender& appender, It first, Se last) + noexcept(noexcept(traits::append(appender.container, std::move(first), std::move(last)))) + { + traits::append(appender.container, std::move(first), std::move(last)); + } +}; + } // traits } // iris::x4 diff --git a/include/iris/x4/core/detail/parse_alternative.hpp b/include/iris/x4/core/detail/parse_alternative.hpp index e3d434392..25167d704 100644 --- a/include/iris/x4/core/detail/parse_alternative.hpp +++ b/include/iris/x4/core/detail/parse_alternative.hpp @@ -71,7 +71,7 @@ template struct pass_parser_attribute { using attribute_type = parser_traits::attribute_type; - using substitute_type = traits::variant_find_holdable_type::type; + using substitute_type = variant_find_holdable_type::type; using type = std::conditional_t< std::same_as, @@ -112,7 +112,7 @@ struct pass_non_variant_attribute // Unwrap single element sequences template - requires traits::is_size_one_sequence_v + requires tuple_is_size_one_sequence_v struct pass_non_variant_attribute { using attr_type = std::remove_reference_t< @@ -131,7 +131,7 @@ struct pass_non_variant_attribute }; template - requires (!traits::is_variant_v) + requires (!is_variant_v) struct pass_parser_attribute : pass_non_variant_attribute {}; @@ -341,7 +341,7 @@ struct parse_into_container_impl> return parse_alternative_all::call( std::index_sequence_for{}, [&](auto& container_attr) { - if constexpr (traits::is_variant_v::type>) { + if constexpr (is_variant_v::type>) { return detail::parse_into_container(alternative_helper{nary::get(parser.elems)}, first, last, ctx, container_attr); } else { return detail::parse_into_container(nary::get(parser.elems), first, last, ctx, container_attr); diff --git a/include/iris/x4/core/detail/parse_into_container.hpp b/include/iris/x4/core/detail/parse_into_container.hpp index 6b7cd56c9..64fd2a440 100644 --- a/include/iris/x4/core/detail/parse_into_container.hpp +++ b/include/iris/x4/core/detail/parse_into_container.hpp @@ -44,10 +44,10 @@ struct parser_accepts_container }; template - requires traits::is_variant_v::attribute_type> + requires is_variant_v::attribute_type> struct parser_accepts_container { - using alternative_type = traits::variant_find_holdable_type< + using alternative_type = variant_find_holdable_type< typename parser_traits::attribute_type, Container >::type; @@ -83,7 +83,7 @@ struct parse_into_container_impl_default } } else { - if constexpr (traits::is_size_one_sequence_v) { + if constexpr (tuple_is_size_one_sequence_v) { // attribute is single element tuple-like; unwrap and try again return parse_into_container_impl_default::call(parser, first, last, ctx, alloy::get<0>(unwrapped_attr)); } else { @@ -110,16 +110,16 @@ parse_into_container(Parser const& parser, It& first, Se const& last, Context co } else if constexpr (is_recursive_wrapper_v) { return detail::parse_into_container(parser, first, last, ctx, *attr); - } else if constexpr (traits::is_size_one_sequence_v) { + } else if constexpr (tuple_is_size_one_sequence_v) { // A tuple-like holding a single container; parse into that container return detail::parse_into_container(parser, first, last, ctx, alloy::get<0>(attr)); - } else if constexpr (traits::is_variant_v) { + } else if constexpr (is_variant_v) { // e.g. `char` when the caller is `+char_` using attribute_type = parser_traits::attribute_type; // e.g. `std::string` when the attribute_type is `char` - using substitute_type = traits::variant_find_holdable_type::type>::type; + using substitute_type = variant_find_holdable_type::type>::type; // instead of creating a temporary `substitute_type`, append directly into the emplaced alternative auto& variant_alt = attr.template emplace(); diff --git a/include/iris/x4/core/detail/parse_sequence.hpp b/include/iris/x4/core/detail/parse_sequence.hpp index 331aff7ee..4e6acc524 100644 --- a/include/iris/x4/core/detail/parse_sequence.hpp +++ b/include/iris/x4/core/detail/parse_sequence.hpp @@ -111,7 +111,7 @@ struct parse_sequence_tuple if constexpr (I != layout::single_attributed_index) { return elem.parse(first, last, ctx, unused); - } else if constexpr (traits::is_size_one_view_v && !sequence_passes_view::value) { + } else if constexpr (tuple_is_size_one_view_v && !sequence_passes_view::value) { auto&& elem_attr = x4::make_container_appender(alloy::get<0>(attr)); return elem.parse(first, last, ctx, elem_attr); @@ -154,7 +154,7 @@ template Se, class parse_sequence(sequence const& seq, It& first, Se const& last, Context const& ctx, Attr& attr) { static_assert(X4Attribute); - static_assert(!traits::CategorizedAttr); + static_assert(!CategorizedAttr); using layout = sequence_layout; @@ -169,7 +169,7 @@ parse_sequence(sequence const& seq, It& first, Se const& last, Context co } return false; - } else if constexpr (!traits::CategorizedAttr) { + } else if constexpr (!CategorizedAttr) { static_assert(false, "The attribute of a sequence with >=2 attributed elements must be tuple-like."); return false; @@ -194,7 +194,7 @@ parse_sequence(sequence const& seq, It& first, Se const& last, Context co // Attribute is a container template< class... Ps, std::forward_iterator It, std::sentinel_for Se, class Context, - traits::CategorizedAttr ContainerAttr + CategorizedAttr ContainerAttr > [[nodiscard]] constexpr bool parse_sequence(sequence const& seq, It& first, Se const& last, Context const& ctx, ContainerAttr& container_attr) @@ -232,7 +232,7 @@ struct parse_into_container_impl> ) { if constexpr (traits::is_container_v) { - constexpr bool sequence_attribute_can_directly_hold_value_type = traits::can_hold< + constexpr bool sequence_attribute_can_directly_hold_value_type = can_hold< typename parser_traits>::attribute_type, typename traits::container_value::type >::value; diff --git a/include/iris/x4/core/list_like_parser.hpp b/include/iris/x4/core/list_like_parser.hpp index 26036c64d..0d712b463 100644 --- a/include/iris/x4/core/list_like_parser.hpp +++ b/include/iris/x4/core/list_like_parser.hpp @@ -29,7 +29,7 @@ template // non-variant `ExposedAttr` struct unwrap_container_candidate { - using type = traits::synthesized_value< + using type = synthesized_value< unwrap_recursive_t< typename unwrap_container_appender::type > @@ -37,10 +37,10 @@ struct unwrap_container_candidate }; template - requires traits::is_variant_v> + requires is_variant_v> struct unwrap_container_candidate { - using type = traits::variant_find_holdable_type< + using type = variant_find_holdable_type< unwrap_recursive_t, ParserAttr >::type; }; @@ -59,7 +59,7 @@ template } template - requires traits::is_size_one_sequence_v> + requires tuple_is_size_one_sequence_v> [[nodiscard]] constexpr auto&& unwrap_single_element(T&& value) noexcept { return std::forward_like(alloy::get<0>(std::forward(value))); @@ -72,7 +72,7 @@ struct unwrap_single_element_plain }; template - requires traits::is_size_one_sequence_v> + requires tuple_is_size_one_sequence_v> struct unwrap_single_element_plain { using type = std::remove_cvref_t>; @@ -93,8 +93,8 @@ template >::type; auto& unwrapped_attr = detail::unwrap_single_element(iris::unwrap_recursive(attr)); - if constexpr (traits::is_variant_v) { - using container_alternative = traits::variant_find_holdable_type< + if constexpr (is_variant_v) { + using container_alternative = variant_find_holdable_type< unwrapped_attr_type, ParserAttr >::type; diff --git a/include/iris/x4/core/move_to.hpp b/include/iris/x4/core/move_to.hpp index aceca3897..b44ab01a0 100644 --- a/include/iris/x4/core/move_to.hpp +++ b/include/iris/x4/core/move_to.hpp @@ -40,7 +40,7 @@ constexpr void move_to(Source&&, Dest&) = delete; // `Source` and `Dest` do not // constraint that checks `std::is_same_v`, thanks to // the ordinary overload resolution rules of C++. -template +template constexpr void move_to(T const&& src, T& dest) noexcept(std::is_nothrow_assignable_v) { @@ -48,7 +48,7 @@ constexpr void move_to(T const&& src, T& dest) dest = std::move(src); } -template +template constexpr void move_to(T&& src, T& dest) noexcept(std::is_nothrow_assignable_v) { @@ -56,7 +56,7 @@ constexpr void move_to(T&& src, T& dest) dest = std::forward(src); } -template +template constexpr void move_to(T const& src, T& dest) noexcept(std::is_nothrow_copy_assignable_v) { @@ -64,7 +64,7 @@ constexpr void move_to(T const& src, T& dest) dest = src; } -template +template constexpr void move_to(T&, T&) noexcept { static_assert( @@ -114,8 +114,8 @@ constexpr void move_to(It const&, Se const&, unused_type const&&) = delete; // t // Category specific -------------------------------------- -template Dest> - requires traits::is_size_one_sequence_v +template Dest> + requires tuple_is_size_one_sequence_v constexpr void move_to(Source&& src, Dest& dest) noexcept(noexcept(dest = std::forward_like(alloy::get<0>(std::forward(src))))) @@ -125,8 +125,8 @@ move_to(Source&& src, Dest& dest) dest = std::forward_like(alloy::get<0>(std::forward(src))); } -template Dest> - requires (!traits::is_size_one_sequence_v) +template Dest> + requires (!tuple_is_size_one_sequence_v) constexpr void move_to(Source&& src, Dest& dest) noexcept(std::is_nothrow_assignable_v) @@ -138,10 +138,10 @@ move_to(Source&& src, Dest& dest) dest = std::forward(src); } -template Dest> +template Dest> requires - traits::is_same_size_sequence_v && - (!traits::is_size_one_sequence_v) + tuple_is_same_size_sequence_v && + (!tuple_is_size_one_sequence_v) constexpr void move_to(Source&& src, Dest& dest) noexcept(noexcept(alloy::tuple_assign(std::forward(src), dest))) @@ -153,7 +153,7 @@ move_to(Source&& src, Dest& dest) alloy::tuple_assign(std::forward(src), dest); } -template Dest> +template Dest> requires std::is_assignable_v constexpr void move_to(Source&& src, Dest& dest) @@ -166,8 +166,8 @@ move_to(Source&& src, Dest& dest) dest = std::forward(src); } -template Dest> - requires (!std::is_assignable_v) && traits::is_size_one_sequence_v +template Dest> + requires (!std::is_assignable_v) && tuple_is_size_one_sequence_v constexpr void move_to(Source&& src, Dest& dest) noexcept(noexcept(dest = std::forward_like(alloy::get<0>(std::forward(src))))) @@ -185,7 +185,7 @@ move_to(Source&& src, Dest& dest) dest = std::forward_like(alloy::get<0>(std::forward(src))); } -template Dest> +template Dest> constexpr void move_to(Source&& src, Dest& dest) noexcept(std::is_nothrow_assignable_v) @@ -200,7 +200,7 @@ move_to(Source&& src, Dest& dest) template struct container_appender; -template Se, traits::CategorizedAttr Dest> +template Se, CategorizedAttr Dest> constexpr void move_to(It first, Se last, Dest& dest) // never noexcept, requires container insertion @@ -228,8 +228,8 @@ move_to(It first, Se last, Dest& dest) traits::append(dest, first, last); // try to reuse underlying memory buffer } -template Se, traits::CategorizedAttr Dest> - requires traits::is_size_one_sequence_v +template Se, CategorizedAttr Dest> + requires tuple_is_size_one_sequence_v constexpr void move_to(It first, Se last, Dest& dest) noexcept(noexcept(x4::move_to(first, last, alloy::get<0>(dest)))) @@ -239,7 +239,7 @@ move_to(It first, Se last, Dest& dest) // Move non-container `src` into container `dest`. // e.g. Source=std::string_view, Dest=std::string (used in `fixed_value_parser`) -template Dest> +template Dest> requires (!traits::X4Container) && (!std::same_as, unused_container_type>) @@ -256,7 +256,7 @@ move_to(Source&& src, Dest& dest) } } -template Dest> +template Dest> constexpr void move_to(Source&& src, Dest& dest) // TODO: noexcept @@ -275,8 +275,8 @@ move_to(Source&& src, Dest& dest) } // Size-one tuple-like forwarding -template Dest> - requires traits::is_size_one_sequence_v +template Dest> + requires tuple_is_size_one_sequence_v constexpr void move_to(Source&& src, Dest& dest) noexcept(noexcept(x4::move_to(std::forward(src), alloy::get<0>(dest)))) diff --git a/include/iris/x4/core/parser_traits.hpp b/include/iris/x4/core/parser_traits.hpp index 2aac32c3d..a7ba115d4 100644 --- a/include/iris/x4/core/parser_traits.hpp +++ b/include/iris/x4/core/parser_traits.hpp @@ -47,7 +47,7 @@ struct get_attribute_type template struct get_handles_container { - static constexpr bool value = traits::can_hold< + static constexpr bool value = can_hold< typename get_attribute_type::type, Container >::value; diff --git a/include/iris/x4/core/traits/attribute_category.hpp b/include/iris/x4/core/traits/attribute_category.hpp index 524e8d821..64f2f46f1 100644 --- a/include/iris/x4/core/traits/attribute_category.hpp +++ b/include/iris/x4/core/traits/attribute_category.hpp @@ -18,6 +18,7 @@ #include +#include #include namespace iris::x4 { @@ -25,22 +26,20 @@ namespace iris::x4 { struct unused_type; struct unused_container_type; -} // iris::x4 - -namespace iris::x4::traits { +struct unused_tag {}; +struct plain_tag {}; +struct container_tag {}; +struct tuple_tag {}; +struct variant_tag {}; +struct optional_tag {}; -struct unused_attr {}; -struct plain_attr {}; -struct container_attr {}; -struct tuple_attr {}; -struct variant_attr {}; -struct optional_attr {}; +namespace detail { template struct attribute_category { static_assert(X4NonUnusedAttribute); - using type = plain_attr; + using type = plain_tag; }; template @@ -58,63 +57,65 @@ struct attribute_category : attribute_category {}; template struct attribute_category : attribute_category {}; -template -using attribute_category_t = typename attribute_category::type; - template<> struct attribute_category { - using type = unused_attr; + using type = unused_tag; }; template<> struct attribute_category { - using type = container_attr; + using type = container_tag; // The attribute category type for `unused_container_type` is // `container_attribute`, but it does not satisfy `is_container`. }; -template -concept CategorizedAttr = - X4Attribute> && - // Don't use `std::same_as` here, it bloats the compilation error. - std::is_same_v>::type, AttrCategoryTag>; - -template -concept NonUnusedAttr = - X4Attribute> && - !std::is_same_v>::type, unused_attr>; - template requires alloy::is_tuple_like_v struct attribute_category { - using type = tuple_attr; + using type = tuple_tag; }; template requires is_variant_v> struct attribute_category { - using type = variant_attr; + using type = variant_tag; }; template requires is_optional_v> struct attribute_category { - using type = optional_attr; + using type = optional_tag; }; template requires traits::is_container_v> struct attribute_category { - using type = container_attr; + using type = container_tag; }; -} // iris::x4::traits +} // detail + +template +using attribute_category_t = detail::attribute_category::type; + +template +concept CategorizedAttr = + X4Attribute> && + // Don't use `std::same_as` here, it bloats the compilation error. + std::same_as, AttrCategoryTag>; + +template +concept NonUnusedCategorizedAttr = + X4Attribute> && + !std::same_as, unused_tag>; + +} // iris::x4 #endif diff --git a/include/iris/x4/core/traits/can_hold.hpp b/include/iris/x4/core/traits/can_hold.hpp index 9e8b79c89..25425d699 100644 --- a/include/iris/x4/core/traits/can_hold.hpp +++ b/include/iris/x4/core/traits/can_hold.hpp @@ -22,7 +22,7 @@ #include #include -namespace iris::x4::traits { +namespace iris::x4 { template struct can_hold; @@ -43,12 +43,12 @@ template struct is_all_substitute_for_tuple : std::false_type {}; template - requires is_same_size_sequence_v + requires tuple_is_same_size_sequence_v struct is_all_substitute_for_tuple : is_all_substitute_for_tuple_impl {}; template struct value_type_can_hold - : can_hold::type, typename container_value::type> + : can_hold::type, typename traits::container_value::type> {}; // This "implementation" exists for short-circuiting `can_hold` for certain trivial combinations @@ -65,8 +65,8 @@ struct can_hold_impl template requires - is_container_v && - is_container_v + traits::is_container_v && + traits::is_container_v struct can_hold_impl : detail::value_type_can_hold {}; @@ -111,6 +111,6 @@ struct can_hold static_assert(X4Attribute); }; -} // iris::x4::traits +} // iris::x4 #endif diff --git a/include/iris/x4/core/traits/char_encoding_traits.hpp b/include/iris/x4/core/traits/char_encoding_traits.hpp index 211bbb7fe..3a787467c 100644 --- a/include/iris/x4/core/traits/char_encoding_traits.hpp +++ b/include/iris/x4/core/traits/char_encoding_traits.hpp @@ -21,7 +21,7 @@ # include #endif -namespace iris::x4::traits { +namespace iris::x4 { namespace detail { @@ -82,6 +82,6 @@ template<> struct char_encoding_traits : detail::char_encoding_traits_impl {}; #endif -} // iris::x4::traits +} // iris::x4 #endif diff --git a/include/iris/x4/core/traits/numeric_traits.hpp b/include/iris/x4/core/traits/numeric_traits.hpp index 65e93364a..f7f4d2ddb 100644 --- a/include/iris/x4/core/traits/numeric_traits.hpp +++ b/include/iris/x4/core/traits/numeric_traits.hpp @@ -16,7 +16,7 @@ #include #include -namespace iris::x4::traits { +namespace iris::x4 { // Customization points for numeric operations @@ -76,6 +76,6 @@ template struct check_overflow : std::bool_constant::is_bounded> {}; -} // iris::x4::traits +} // iris::x4 #endif diff --git a/include/iris/x4/core/traits/optional_traits.hpp b/include/iris/x4/core/traits/optional_traits.hpp index 6c76fa874..0c8bddc2a 100644 --- a/include/iris/x4/core/traits/optional_traits.hpp +++ b/include/iris/x4/core/traits/optional_traits.hpp @@ -21,11 +21,6 @@ namespace iris::x4 { struct unused_type; struct unused_container_type; -} // iris::x4 - - -namespace iris::x4::traits { - template struct is_optional : std::false_type {}; @@ -78,6 +73,6 @@ struct optional_value using type = unused_type; }; -} // iris::x4::traits +} // iris::x4 #endif diff --git a/include/iris/x4/core/traits/transform_attribute.hpp b/include/iris/x4/core/traits/transform_attribute.hpp index 866fd5933..7b6ecc515 100644 --- a/include/iris/x4/core/traits/transform_attribute.hpp +++ b/include/iris/x4/core/traits/transform_attribute.hpp @@ -20,7 +20,7 @@ #include #include -namespace iris::x4::traits { +namespace iris::x4 { template struct transform_attribute @@ -116,6 +116,6 @@ struct transform_attribute static_assert(!std::is_reference_v, "Transformed cannot be a reference type"); }; -} // iris::x4::traits +} // iris::x4 #endif diff --git a/include/iris/x4/core/traits/tuple_traits.hpp b/include/iris/x4/core/traits/tuple_traits.hpp index 805c65ef7..124f58a91 100644 --- a/include/iris/x4/core/traits/tuple_traits.hpp +++ b/include/iris/x4/core/traits/tuple_traits.hpp @@ -16,10 +16,10 @@ #include -namespace iris::x4::traits { +namespace iris::x4 { template -struct has_same_size +struct tuple_has_same_size : std::bool_constant< alloy::tuple_size_v> == alloy::tuple_size_v> @@ -27,49 +27,49 @@ struct has_same_size {}; template -constexpr bool has_same_size_v = has_same_size::value; +constexpr bool tuple_has_same_size_v = tuple_has_same_size::value; template -struct has_size +struct tuple_has_size : std::bool_constant> == N> {}; template -constexpr bool has_size_v = has_size::value; +constexpr bool tuple_has_size_v = tuple_has_size::value; template -struct is_same_size_sequence +struct tuple_is_same_size_sequence : std::bool_constant>, alloy::is_tuple_like>, - has_same_size + tuple_has_same_size >> {}; template -constexpr bool is_same_size_sequence_v = is_same_size_sequence::value; +constexpr bool tuple_is_same_size_sequence_v = tuple_is_same_size_sequence::value; template -struct is_size_one_sequence +struct tuple_is_size_one_sequence : std::bool_constant>, - has_size + tuple_has_size >> {}; template -constexpr bool is_size_one_sequence_v = is_size_one_sequence::value; +constexpr bool tuple_is_size_one_sequence_v = tuple_is_size_one_sequence::value; template -struct is_size_one_view +struct tuple_is_size_one_view : std::bool_constant>, - has_size + tuple_has_size >> {}; template -constexpr bool is_size_one_view_v = is_size_one_view::value; +constexpr bool tuple_is_size_one_view_v = tuple_is_size_one_view::value; template @@ -82,12 +82,12 @@ template using synthesized_value_t = typename synthesized_value::type; template - requires is_size_one_sequence_v> + requires tuple_is_size_one_sequence_v> struct synthesized_value { using type = std::remove_cvref_t>; }; -} // iris::x4::traits +} // iris::x4 #endif diff --git a/include/iris/x4/core/traits/variant_traits.hpp b/include/iris/x4/core/traits/variant_traits.hpp index bac6380c5..94a54f240 100644 --- a/include/iris/x4/core/traits/variant_traits.hpp +++ b/include/iris/x4/core/traits/variant_traits.hpp @@ -19,7 +19,7 @@ #include #include -namespace iris::x4::traits { +namespace iris::x4 { template struct is_variant : std::false_type {}; @@ -28,7 +28,7 @@ template constexpr bool is_variant_v = is_variant::value; template -struct is_variant> : std::true_type {}; +struct is_variant> : std::true_type {}; namespace detail { @@ -42,13 +42,13 @@ struct any_of_unwrapped_exactly_same {}; template - requires std::same_as> + requires std::same_as> struct any_of_unwrapped_exactly_same : std::true_type {}; template - requires (!std::same_as>) + requires (!std::same_as>) struct any_of_unwrapped_exactly_same : any_of_unwrapped_exactly_same {}; @@ -66,7 +66,7 @@ template struct variant_find_holdable_type_impl { using type = std::conditional_t< - can_hold, T>::value, + can_hold, T>::value, // Given some type `T`, when both `T` and `recursive_wrapper` is seen // during attribute resolution, X4 should ideally materialize the latter @@ -110,6 +110,6 @@ struct variant_find_holdable_type, T> using type = detail::variant_find_holdable_type_impl::type; }; -} // iris::x4::traits +} // iris::x4 #endif diff --git a/include/iris/x4/debug/print_attribute.hpp b/include/iris/x4/debug/print_attribute.hpp index 7e4d954b6..5082bc60d 100644 --- a/include/iris/x4/debug/print_attribute.hpp +++ b/include/iris/x4/debug/print_attribute.hpp @@ -233,7 +233,7 @@ struct print_attribute_debug out << "unused_container"; } - static void call(std::ostream& out, traits::CategorizedAttr auto const& val) + static void call(std::ostream& out, CategorizedAttr auto const& val) { if constexpr ( std::disjunction_v< @@ -265,14 +265,14 @@ struct print_attribute_debug } // for tuple-likes - static void call(std::ostream& out, traits::CategorizedAttr auto const& val) + static void call(std::ostream& out, CategorizedAttr auto const& val) { out << '<'; alloy::for_each(val, detail::print_tuple_like(out)); out << '>'; } - template T_> + template T_> requires (!std::is_same_v) static void call(std::ostream& out, T_ const& val) { @@ -298,12 +298,12 @@ struct print_attribute_debug } // for variant types - static void call(std::ostream& out, traits::CategorizedAttr auto const& val) + static void call(std::ostream& out, CategorizedAttr auto const& val) { iris::visit(detail::print_visitor{out}, val); } - static void call(std::ostream& out, traits::CategorizedAttr auto const& val) + static void call(std::ostream& out, CategorizedAttr auto const& val) { if (val) { x4::print_attribute(out, *val); diff --git a/include/iris/x4/directive/repeat.hpp b/include/iris/x4/directive/repeat.hpp index 45edbf6a0..b260b8819 100644 --- a/include/iris/x4/directive/repeat.hpp +++ b/include/iris/x4/directive/repeat.hpp @@ -91,8 +91,8 @@ struct repeat_directive : proxy_parser, Subjec template static constexpr bool handles_container = std::disjunction_v< - traits::can_hold::attribute_type, Container>, - traits::can_hold::attribute_type, typename traits::container_value::type> + can_hold::attribute_type, Container>, + can_hold::attribute_type, typename traits::container_value::type> >; template diff --git a/include/iris/x4/numeric/bool.hpp b/include/iris/x4/numeric/bool.hpp index 8c6df2eb7..c27b7a0e8 100644 --- a/include/iris/x4/numeric/bool.hpp +++ b/include/iris/x4/numeric/bool.hpp @@ -36,7 +36,7 @@ struct bool_policies parse_true(It& first, Se const& last, Attr& attr_, CaseCompare const& compare) noexcept(noexcept(x4::move_to(T(true), attr_))) { - using token_def = traits::numeric_token>; + using token_def = numeric_token>; if (detail::string_parse(std::basic_string_view{token_def::true_}, first, last, unused_container, compare)) { x4::move_to(T(true), attr_); return true; @@ -49,7 +49,7 @@ struct bool_policies parse_false(It& first, Se const& last, Attr& attr_, CaseCompare const& compare) noexcept(noexcept(x4::move_to(T(false), attr_))) { - using token_def = traits::numeric_token>; + using token_def = numeric_token>; if (detail::string_parse(std::basic_string_view{token_def::false_}, first, last, unused_container, compare)) { x4::move_to(T(false), attr_); return true; @@ -79,14 +79,14 @@ struct bool_parser : parser> noexcept( std::is_nothrow_copy_assignable_v && noexcept(x4::skip_over(first, last, ctx)) && - noexcept(Policy::parse_true(first, last, attr, x4::get_case_compare>>(ctx))) && - noexcept(Policy::parse_false(first, last, attr, x4::get_case_compare>>(ctx))) + noexcept(Policy::parse_true(first, last, attr, x4::get_case_compare>>(ctx))) && + noexcept(Policy::parse_false(first, last, attr, x4::get_case_compare>>(ctx))) ) { auto it = first; x4::skip_over(it, last, ctx); - auto const& compare = x4::get_case_compare>>(ctx); + auto const& compare = x4::get_case_compare>>(ctx); bool const ok = Policy::parse_true(it, last, attr, compare) || Policy::parse_false(it, last, attr, compare); @@ -142,14 +142,14 @@ struct literal_bool_parser : parser> noexcept( std::is_nothrow_copy_assignable_v && noexcept(x4::skip_over(first, last, ctx)) && - noexcept(Policy::parse_true(first, last, attr, x4::get_case_compare>>(ctx))) && - noexcept(Policy::parse_false(first, last, attr, x4::get_case_compare>>(ctx))) + noexcept(Policy::parse_true(first, last, attr, x4::get_case_compare>>(ctx))) && + noexcept(Policy::parse_false(first, last, attr, x4::get_case_compare>>(ctx))) ) { auto it = first; x4::skip_over(it, last, ctx); - auto const& compare = x4::get_case_compare>>(ctx); + auto const& compare = x4::get_case_compare>>(ctx); bool const ok = (static_cast(ExpectedValue) && Policy::parse_true(it, last, attr, compare)) || (!static_cast(ExpectedValue) && Policy::parse_false(it, last, attr, compare)); diff --git a/include/iris/x4/numeric/real.hpp b/include/iris/x4/numeric/real.hpp index 28fe5cb3b..d1e4e0b9e 100644 --- a/include/iris/x4/numeric/real.hpp +++ b/include/iris/x4/numeric/real.hpp @@ -59,7 +59,7 @@ struct ureal_policies noexcept(noexcept(*first) && noexcept(++first)) { using CharT = std::iter_value_t; - if (first == last || *first != traits::numeric_token::dot) { + if (first == last || *first != numeric_token::dot) { return false; } ++first; @@ -79,7 +79,7 @@ struct ureal_policies parse_exp(It& first, Se const& last) noexcept(noexcept(*first) && noexcept(++first)) { - using token_def = traits::numeric_token>; + using token_def = numeric_token>; if (first == last || (*first != token_def::e && *first != token_def::E)) { return false; } @@ -111,7 +111,7 @@ struct ureal_policies [[nodiscard]] static constexpr bool parse_nan(It& first, Se const& last, Attr& attr_) { - using token_def = traits::numeric_token>; + using token_def = numeric_token>; if (first == last) return false; // end of input reached if (*first != token_def::n && *first != token_def::N) { @@ -141,7 +141,7 @@ struct ureal_policies [[nodiscard]] static constexpr bool parse_inf(It& first, Se const& last, Attr& attr_) { - using token_def = traits::numeric_token>; + using token_def = numeric_token>; if (first == last) return false; // end of input reached if (*first != token_def::i && *first != token_def::I) return false; // not "inf" diff --git a/include/iris/x4/numeric/utils/extract_int.hpp b/include/iris/x4/numeric/utils/extract_int.hpp index 15779a249..7c2a9ade8 100644 --- a/include/iris/x4/numeric/utils/extract_int.hpp +++ b/include/iris/x4/numeric/utils/extract_int.hpp @@ -101,7 +101,7 @@ struct radix_traits template [[nodiscard]] static constexpr bool is_valid(CharT ch) noexcept { - using token_def = traits::numeric_token; + using token_def = numeric_token; return (ch >= token_def::_0 && ch <= (Radix > 10 ? token_def::_9 : static_cast(token_def::_0 + Radix -1))) || (Radix > 10 && ch >= token_def::a && ch <= static_cast(token_def::a + Radix -10 -1)) || (Radix > 10 && ch >= token_def::A && ch <= static_cast(token_def::A + Radix -10 -1)); @@ -109,12 +109,12 @@ struct radix_traits template [[nodiscard]] static constexpr unsigned digit(CharT ch) - noexcept(noexcept(traits::char_encoding_traits::encoding_type::tolower(ch))) + noexcept(noexcept(char_encoding_traits::encoding_type::tolower(ch))) { - using token_def = traits::numeric_token; + using token_def = numeric_token; return (Radix <= 10 || (ch >= token_def::_0 && ch <= token_def::_9)) ? ch - token_def::_0 - : traits::char_encoding_traits::encoding_type::tolower(ch) - token_def::a + 10; + : char_encoding_traits::encoding_type::tolower(ch) - token_def::a + 10; } }; @@ -190,7 +190,7 @@ struct int_extractor MaxDigits < 0 || MaxDigits > digits_traits::value ) && - traits::check_overflow::value; + check_overflow::value; template requires need_check_overflow @@ -276,7 +276,7 @@ struct extract_int using extractor = int_extractor; using char_type = std::iter_value_t; - using token_def = traits::numeric_token>; + using token_def = numeric_token>; It it = first; std::size_t leading_zeros = 0; @@ -363,7 +363,7 @@ struct extract_int using extractor = int_extractor; using char_type = std::iter_value_t; - using token_def = traits::numeric_token>; + using token_def = numeric_token>; It it = first; std::size_t count = 0; @@ -449,7 +449,7 @@ extract_sign(It& first, Se const& last) noexcept(++first) ) { - using token_def = traits::numeric_token>; + using token_def = numeric_token>; (void)last; assert(first != last); // precondition diff --git a/include/iris/x4/numeric/utils/extract_real.hpp b/include/iris/x4/numeric/utils/extract_real.hpp index 50c2f1c6a..ebabb29b5 100644 --- a/include/iris/x4/numeric/utils/extract_real.hpp +++ b/include/iris/x4/numeric/utils/extract_real.hpp @@ -46,11 +46,11 @@ scale(int exp, T& n) return false; } } - n *= traits::pow10(exp); + n *= x4::pow10(exp); } else { if (exp < min_exp) { - n /= traits::pow10(-min_exp); + n /= x4::pow10(-min_exp); // return false if exp still exceeds the min_exp // do this check only for primitive types! @@ -62,10 +62,10 @@ scale(int exp, T& n) } } - n /= traits::pow10(-exp); + n /= x4::pow10(-exp); } else { - n /= traits::pow10(-exp); + n /= x4::pow10(-exp); } } return true; diff --git a/include/iris/x4/numeric/utils/pow10.hpp b/include/iris/x4/numeric/utils/pow10.hpp index d871a918d..ace0d5a3f 100644 --- a/include/iris/x4/numeric/utils/pow10.hpp +++ b/include/iris/x4/numeric/utils/pow10.hpp @@ -20,7 +20,7 @@ #include #include -namespace iris::x4::traits { +namespace iris::x4 { namespace detail { @@ -119,6 +119,6 @@ template return pow10_helper::call(dim); } -} // iris::x4::traits +} // iris::x4 #endif diff --git a/include/iris/x4/operator/delimited_list.hpp b/include/iris/x4/operator/delimited_list.hpp index 68b3c416e..b6a06db5b 100644 --- a/include/iris/x4/operator/delimited_list.hpp +++ b/include/iris/x4/operator/delimited_list.hpp @@ -30,7 +30,7 @@ struct delimited_list : binary_parser, Left, Right> template static constexpr bool handles_container = std::disjunction_v< std::bool_constant::template handles_container>, - traits::can_hold::attribute_type, typename traits::container_value::type> + can_hold::attribute_type, typename traits::container_value::type> >; using binary_parser::binary_parser; diff --git a/include/iris/x4/operator/kleene.hpp b/include/iris/x4/operator/kleene.hpp index 80c9535ea..5e08087a5 100644 --- a/include/iris/x4/operator/kleene.hpp +++ b/include/iris/x4/operator/kleene.hpp @@ -31,7 +31,7 @@ struct kleene : unary_parser, Subject> template static constexpr bool handles_container = std::disjunction_v< std::bool_constant::template handles_container>, - traits::can_hold::attribute_type, typename traits::container_value::type> + can_hold::attribute_type, typename traits::container_value::type> >; using unary_parser::unary_parser; diff --git a/include/iris/x4/operator/optional.hpp b/include/iris/x4/operator/optional.hpp index fb693c777..69ec49d30 100644 --- a/include/iris/x4/operator/optional.hpp +++ b/include/iris/x4/operator/optional.hpp @@ -31,12 +31,12 @@ namespace iris::x4 { template struct optional : unary_parser, Subject> { - using attribute_type = traits::build_optional::attribute_type>::type; + using attribute_type = build_optional::attribute_type>::type; template static constexpr bool handles_container = std::disjunction_v< std::bool_constant::template handles_container>, - traits::can_hold::attribute_type, typename traits::container_value::type> + can_hold::attribute_type, typename traits::container_value::type> >; using unary_parser::unary_parser; @@ -64,7 +64,7 @@ struct optional : unary_parser, Subject> // optional attribute template< std::forward_iterator It, std::sentinel_for Se, class Context, - traits::CategorizedAttr Attr + CategorizedAttr Attr > [[nodiscard]] constexpr bool parse(It& first, Se const& last, Context const& ctx, Attr& attr) const @@ -87,7 +87,7 @@ struct optional : unary_parser, Subject> // container attribute template< std::forward_iterator It, std::sentinel_for Se, class Context, - traits::CategorizedAttr Attr + CategorizedAttr Attr > [[nodiscard]] constexpr bool parse(It& first, Se const& last, Context const& ctx, Attr& attr) const diff --git a/include/iris/x4/operator/plus.hpp b/include/iris/x4/operator/plus.hpp index 289de9b29..a91b13fa8 100644 --- a/include/iris/x4/operator/plus.hpp +++ b/include/iris/x4/operator/plus.hpp @@ -31,7 +31,7 @@ struct plus : unary_parser, Subject> template static constexpr bool handles_container = std::disjunction_v< std::bool_constant::template handles_container>, - traits::can_hold::attribute_type, typename traits::container_value::type> + can_hold::attribute_type, typename traits::container_value::type> >; using unary_parser::unary_parser; diff --git a/include/iris/x4/rule.hpp b/include/iris/x4/rule.hpp index aa5819e74..8dc83cb23 100644 --- a/include/iris/x4/rule.hpp +++ b/include/iris/x4/rule.hpp @@ -96,7 +96,7 @@ struct rule_impl using rcontext_t = std::remove_cvref_t< decltype(x4::replace_first_context( std::declval(), - std::declval::type&>() + std::declval::type&>() )) >; @@ -248,7 +248,7 @@ struct rule_impl ) { // Do down-stream transformation, provide attribute for `rhs` parser - using transform = traits::transform_attribute; + using transform = transform_attribute; using transform_attr = transform::type; transform_attr rhs_attr = transform::pre(exposed_attr); diff --git a/include/iris/x4/string/detail/string_parse.hpp b/include/iris/x4/string/detail/string_parse.hpp index 16d966748..26498888a 100644 --- a/include/iris/x4/string/detail/string_parse.hpp +++ b/include/iris/x4/string/detail/string_parse.hpp @@ -36,8 +36,8 @@ string_parse( static_assert(!std::is_array_v); using CharT = std::ranges::range_value_t; - using synthesized_value_type = traits::synthesized_value_t; - static_assert(std::same_as, traits::container_attr>); + using synthesized_value_type = synthesized_value_t; + static_assert(std::same_as, container_tag>); using value_type = traits::container_value::type; static_assert(!CharLike || !CharIncompatibleWith, "Mixing incompatible char types is not allowed"); static_assert(!CharIncompatibleWith, CharT>, "Mixing incompatible char types is not allowed"); @@ -84,8 +84,8 @@ string_parse( It& first, Se const& last, Attr& attr ) noexcept(std::same_as, unused_container_type>) { - using synthesized_value_type = traits::synthesized_value_t; - static_assert(std::same_as, traits::container_attr>); + using synthesized_value_type = synthesized_value_t; + static_assert(std::same_as, container_tag>); using value_type = traits::container_value::type; static_assert(!CharLike || !CharIncompatibleWith, "Mixing incompatible char types is not allowed"); static_assert(!CharIncompatibleWith, CharT>, "Mixing incompatible char types is not allowed"); diff --git a/include/iris/x4/traits/attribute_traits.hpp b/include/iris/x4/traits/attribute_traits.hpp index e7c39f250..2dda59fee 100644 --- a/include/iris/x4/traits/attribute_traits.hpp +++ b/include/iris/x4/traits/attribute_traits.hpp @@ -56,7 +56,7 @@ concept proper_attribute_for = template struct attribute_traits { - static_assert(CategorizedAttr); + static_assert(CategorizedAttr); static constexpr void reset(ExposedAttr& attr) noexcept(noexcept(attr = ExposedAttr{})) @@ -92,7 +92,7 @@ struct attribute_traits template inline constexpr bool is_nothrow_resettable_v = noexcept(attribute_traits::reset(std::declval())); -template UnusedTypeT> +template UnusedTypeT> struct attribute_traits { static constexpr void reset(UnusedTypeT const&) noexcept @@ -105,7 +105,7 @@ struct attribute_traits } }; -template OptionalT> +template OptionalT> struct attribute_traits { using value_type = OptionalT::value_type; @@ -118,7 +118,7 @@ struct attribute_traits // The branch writes the optional as a whole (a nested optional parser, or // a rule with an optional attribute): hand it over disengaged. template - requires std::same_as || CategorizedAttr + requires std::same_as || CategorizedAttr static constexpr OptionalT& clear(OptionalT& opt) noexcept { opt.reset(); @@ -129,7 +129,7 @@ struct attribute_traits // contained object if already engaged, and prepare that value for `ParserAttr`. template requires - (!CategorizedAttr) && + (!CategorizedAttr) && detail::clearable_for static constexpr decltype(auto) clear(OptionalT& opt) { @@ -165,7 +165,7 @@ inline constexpr bool is_variant_nothrow_resettable = [](std: } // detail -template VariantT> +template VariantT> struct attribute_traits { static constexpr void reset(VariantT& var) @@ -220,7 +220,7 @@ struct attribute_traits } }; -template ContainerT> +template ContainerT> struct attribute_traits { static constexpr void reset(ContainerT& container) @@ -249,7 +249,7 @@ inline constexpr bool is_tuple_nothrow_resettable = [](std::i } // detail -template TupleLikeT> +template TupleLikeT> struct attribute_traits { static constexpr void reset(TupleLikeT& tup) diff --git a/test/x4/alternative.cpp b/test/x4/alternative.cpp index c87d6364d..e9132fea7 100644 --- a/test/x4/alternative.cpp +++ b/test/x4/alternative.cpp @@ -256,7 +256,7 @@ TEST_CASE("alternative") using attribute_type = x4::parser_traits::attribute_type; STATIC_CHECK(std::same_as>); - using substitute_type = x4::traits::variant_find_holdable_type::type; + using substitute_type = x4::variant_find_holdable_type::type; STATIC_CHECK(std::same_as>); Attr var; @@ -270,7 +270,7 @@ TEST_CASE("alternative") using attribute_type = x4::parser_traits::attribute_type; STATIC_CHECK(std::same_as); - using substitute_type = x4::traits::variant_find_holdable_type::type; + using substitute_type = x4::variant_find_holdable_type::type; STATIC_CHECK(std::same_as); Attr var; diff --git a/test/x4/char.cpp b/test/x4/char.cpp index 8474180b0..a93606853 100644 --- a/test/x4/char.cpp +++ b/test/x4/char.cpp @@ -28,11 +28,11 @@ TEST_CASE("char") { static_assert(x4::traits::is_container_v); static_assert(x4::traits::X4Container); - static_assert(x4::traits::CategorizedAttr); + static_assert(x4::CategorizedAttr); static_assert(!x4::traits::is_container_v); static_assert(!x4::traits::X4Container); - static_assert(x4::traits::CategorizedAttr); + static_assert(x4::CategorizedAttr); namespace standard = x4::standard; namespace standard_wide = x4::standard_wide; diff --git a/test/x4/optional.cpp b/test/x4/optional.cpp index cb4348111..acbbc1798 100644 --- a/test/x4/optional.cpp +++ b/test/x4/optional.cpp @@ -46,7 +46,7 @@ struct alloy::adaptor TEST_CASE("optional") { - static_assert(x4::traits::is_optional_v>); + static_assert(x4::is_optional_v>); using x4::int_; using x4::omit; diff --git a/test/x4/partial_success.cpp b/test/x4/partial_success.cpp index d2f327644..843877ee3 100644 --- a/test/x4/partial_success.cpp +++ b/test/x4/partial_success.cpp @@ -95,7 +95,7 @@ TEST_CASE("partial success (alternative)") // Non-string container attribute // Related to: https://github.com/boostorg/spirit/issues/378 { - static_assert(x4::traits::CategorizedAttr, x4::traits::container_attr>); + static_assert(x4::CategorizedAttr, x4::container_tag>); static_assert(x4::traits::X4Container>); static_assert(x4::traits::is_container_v>); @@ -129,7 +129,7 @@ TEST_CASE("partial success (alternative)") // String container attribute // Intended for testing `detail::string_parse` { - static_assert(x4::traits::CategorizedAttr); + static_assert(x4::CategorizedAttr); static_assert(x4::traits::X4Container); static_assert(x4::traits::is_container_v); @@ -179,7 +179,7 @@ TEST_CASE("partial success (alternative)") // Plain attribute { - static_assert(x4::traits::CategorizedAttr); + static_assert(x4::CategorizedAttr); static_assert(!x4::traits::X4Container); static_assert(!x4::traits::is_container_v); @@ -199,7 +199,7 @@ TEST_CASE("partial success (alternative)") { using pair_int = std::pair; - static_assert(x4::traits::CategorizedAttr); + static_assert(x4::CategorizedAttr); static_assert(!x4::traits::X4Container); static_assert(!x4::traits::is_container_v); diff --git a/test/x4/sequence.cpp b/test/x4/sequence.cpp index 09a944574..656afde3d 100644 --- a/test/x4/sequence.cpp +++ b/test/x4/sequence.cpp @@ -536,7 +536,7 @@ TEST_CASE("sequence") }); STATIC_CHECK(traits::is_container_v>); - STATIC_CHECK(traits::CategorizedAttr, x4::traits::container_attr>); + STATIC_CHECK(x4::CategorizedAttr, x4::container_tag>); std::vector v; REQUIRE(parse("ssszs", *x4_test::synth_move_only >> 'z' >> x4_test::synth_move_only, v)); diff --git a/test/x4/substitution.cpp b/test/x4/substitution.cpp index 4d55981ae..d2292cf5e 100644 --- a/test/x4/substitution.cpp +++ b/test/x4/substitution.cpp @@ -8,7 +8,7 @@ #include template -inline constexpr bool can_hold_v = x4::traits::can_hold::value; +inline constexpr bool can_hold_v = x4::can_hold::value; TEST_CASE("can_hold") { diff --git a/test/x4/unused.cpp b/test/x4/unused.cpp index 1cf1ef829..204075913 100644 --- a/test/x4/unused.cpp +++ b/test/x4/unused.cpp @@ -21,8 +21,8 @@ TEST_CASE("unused") { namespace traits = x4::traits; - using traits::Transformable; - using traits::transform_attribute; + using x4::Transformable; + using x4::transform_attribute; using x4::unused_container_type; using x4::unused_container; @@ -66,30 +66,30 @@ TEST_CASE("unused") // unused => unused { STATIC_CHECK(Transformable); - STATIC_CHECK(std::same_as::type, unused_type>); + STATIC_CHECK(std::same_as::type, unused_type>); STATIC_CHECK(Transformable); - STATIC_CHECK(std::same_as::type, unused_type>); + STATIC_CHECK(std::same_as::type, unused_type>); STATIC_CHECK(Transformable); - STATIC_CHECK(std::same_as::type, unused_type>); + STATIC_CHECK(std::same_as::type, unused_type>); STATIC_CHECK(Transformable); - STATIC_CHECK(std::same_as::type, unused_type>); + STATIC_CHECK(std::same_as::type, unused_type>); } // unused_container => unused_container { STATIC_CHECK(Transformable); - STATIC_CHECK(std::same_as::type, unused_container_type>); + STATIC_CHECK(std::same_as::type, unused_container_type>); STATIC_CHECK(Transformable); - STATIC_CHECK(std::same_as::type, unused_container_type>); + STATIC_CHECK(std::same_as::type, unused_container_type>); STATIC_CHECK(Transformable); - STATIC_CHECK(std::same_as::type, unused_container_type>); + STATIC_CHECK(std::same_as::type, unused_container_type>); STATIC_CHECK(Transformable); - STATIC_CHECK(std::same_as::type, unused_container_type>); + STATIC_CHECK(std::same_as::type, unused_container_type>); } }