diff --git a/sprout/container/container_traits.hpp b/sprout/container/container_traits.hpp index ce78458f..f9721831 100644 --- a/sprout/container/container_traits.hpp +++ b/sprout/container/container_traits.hpp @@ -22,6 +22,7 @@ namespace sprout { // inherit_if_size_type // inherit_if_difference_type // inherit_if_pointer + // inherit_if_const_pointer // inherit_if_static_size // SPROUT_INHERIT_IF_XXX_TYPE_DEF_LAZY(value_type); @@ -40,6 +41,18 @@ namespace sprout { // SPROUT_HAS_XXX_VALUE_DEF_LAZY(static_size); + // + // inherit_iterator_if_const_iterator + // inherit_reference_if_const_reference + // inherit_pointer_if_const_pointer + // + SPROUT_INHERIT_ALIAS_IF_XXX_TYPE_DEF_LAZY(iterator, const_iterator); + SPROUT_INHERIT_ALIAS_IF_XXX_TYPE_DEF_LAZY(reference, const_reference); + SPROUT_INHERIT_ALIAS_IF_XXX_TYPE_DEF_LAZY(pointer, const_pointer); + + // + // inherit_if_fixed_size + // template struct inherit_if_fixed_size {}; template @@ -53,6 +66,9 @@ namespace sprout { } }; + // + // container_traits_default + // template struct container_traits_default : public sprout::detail::inherit_if_value_type @@ -86,6 +102,24 @@ namespace sprout { return static_size; } }; + + // + // container_traits_const_default + // + template + struct container_traits_const_default + : public sprout::detail::inherit_if_value_type > + , public sprout::detail::inherit_if_const_iterator > + , public sprout::detail::inherit_if_const_reference > + , public sprout::detail::inherit_if_size_type > + , public sprout::detail::inherit_if_difference_type > + , public sprout::detail::inherit_if_const_pointer > + , public sprout::detail::inherit_if_static_size > + , public sprout::detail::inherit_if_fixed_size > + , public sprout::detail::inherit_iterator_if_const_iterator > + , public sprout::detail::inherit_reference_if_const_reference > + , public sprout::detail::inherit_pointer_if_const_pointer > + {}; } // namespace detail // @@ -97,13 +131,8 @@ namespace sprout { {}; template struct container_traits - : public sprout::container_traits - { - public: - typedef typename sprout::container_traits::const_iterator iterator; - typedef typename sprout::container_traits::const_reference reference; - typedef typename sprout::container_traits::const_pointer pointer; - }; + : public sprout::detail::container_traits_const_default + {}; template struct container_traits @@ -111,13 +140,8 @@ namespace sprout { {}; template struct container_traits - : public sprout::container_traits - { - public: - typedef typename sprout::container_traits::const_iterator iterator; - typedef typename sprout::container_traits::const_reference reference; - typedef typename sprout::container_traits::const_pointer pointer; - }; + : public sprout::detail::container_traits_const_default + {}; } // namespace sprout #endif // #ifndef SPROUT_CONTAINER_CONTAINER_TRAITS_HPP diff --git a/sprout/math/classifications.hpp b/sprout/math/classifications.hpp index 3d6b4cf8..97345d18 100644 --- a/sprout/math/classifications.hpp +++ b/sprout/math/classifications.hpp @@ -3,12 +3,12 @@ #include #include -#include +#include #include +#include +#include #include #include -#include -#include #include #endif // #ifndef SPROUT_MATH_CLASSIFICATIONS_HPP diff --git a/sprout/math/functions.hpp b/sprout/math/functions.hpp index 46c84c9f..48aba0cc 100644 --- a/sprout/math/functions.hpp +++ b/sprout/math/functions.hpp @@ -2,11 +2,12 @@ #define SPROUT_MATH_FUNCTIONS_HPP #include -#include -#include -#include +#include #include #include -#include +#include +#include +#include +#include #endif // #ifndef SPROUT_MATH_FUNCTIONS_HPP diff --git a/sprout/type_traits/inherit_if_xxx.hpp b/sprout/type_traits/inherit_if_xxx.hpp index 22b3a4e7..f5eabcb6 100644 --- a/sprout/type_traits/inherit_if_xxx.hpp +++ b/sprout/type_traits/inherit_if_xxx.hpp @@ -7,9 +7,10 @@ #include // -// SPROUT_INHERIT_IF_XXX_TYPE_DEF +// SPROUT_INHERIT_ALIAS_IF_XXX_TYPE_DEF +// SPROUT_INHERIT_ALIAS_IF_XXX_TYPE_DEF_LAZY // -#define SPROUT_INHERIT_IF_XXX_TYPE_DEF(NAME, TYPE) \ +#define SPROUT_INHERIT_ALIAS_IF_XXX_TYPE_DEF(NAME, ALIAS, TYPE) \ SPROUT_HAS_XXX_TYPE_DEF(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_inherit_if_xxx_type_def_impl_has_, TYPE), __LINE__), TYPE); \ template \ struct NAME {}; \ @@ -19,19 +20,25 @@ typename std::enable_if::value>::type \ > { \ public: \ - typedef typename T::TYPE TYPE; \ + typedef typename T::TYPE ALIAS; \ } +#define SPROUT_INHERIT_ALIAS_IF_XXX_TYPE_DEF_LAZY(ALIAS, TYPE) \ + SPROUT_INHERIT_ALIAS_IF_XXX_TYPE_DEF(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(inherit_, ALIAS), _if_), TYPE), ALIAS, TYPE) // +// SPROUT_INHERIT_IF_XXX_TYPE_DEF // SPROUT_INHERIT_IF_XXX_TYPE_DEF_LAZY // +#define SPROUT_INHERIT_IF_XXX_TYPE_DEF(NAME, TYPE) \ + SPROUT_INHERIT_ALIAS_IF_XXX_TYPE_DEF(NAME, TYPE, TYPE) #define SPROUT_INHERIT_IF_XXX_TYPE_DEF_LAZY(TYPE) \ SPROUT_INHERIT_IF_XXX_TYPE_DEF(SPROUT_PP_CAT(inherit_if_, TYPE), TYPE) // -// SPROUT_INHERIT_IF_XXX_CONSTANT_DEF +// SPROUT_INHERIT_ALIAS_IF_XXX_CONSTANT_DEF +// SPROUT_INHERIT_ALIAS_IF_XXX_CONSTANT_DEF_LAZY // -#define SPROUT_INHERIT_IF_XXX_CONSTANT_DEF(NAME, CONSTANT) \ +#define SPROUT_INHERIT_ALIAS_IF_XXX_CONSTANT_DEF(NAME, ALIAS, CONSTANT) \ SPROUT_HAS_XXX_VALUE_DEF(SPROUT_PP_CAT(SPROUT_PP_CAT(sprout_inherit_if_xxx_constant_def_impl_has_, CONSTANT), __LINE__), CONSTANT); \ template \ struct NAME {}; \ @@ -41,12 +48,17 @@ typename std::enable_if::value>::type \ > { \ public: \ - SPROUT_STATIC_CONSTEXPR decltype(T::CONSTANT) CONSTANT = T::CONSTANT; \ + SPROUT_STATIC_CONSTEXPR decltype(T::CONSTANT) ALIAS = T::CONSTANT; \ } +#define SPROUT_INHERIT_ALIAS_IF_XXX_CONSTANT_DEF_LAZY(ALIAS, CONSTANT) \ + SPROUT_INHERIT_ALIAS_IF_XXX_CONSTANT_DEF(SPROUT_PP_CAT(SPROUT_PP_CAT(SPROUT_PP_CAT(inherit_, ALIAS), _if_), CONSTANT), ALIAS, CONSTANT) // +// SPROUT_INHERIT_IF_XXX_CONSTANT_DEF // SPROUT_INHERIT_IF_XXX_CONSTANT_DEF_LAZY // +#define SPROUT_INHERIT_IF_XXX_CONSTANT_DEF(NAME, CONSTANT) \ + SPROUT_INHERIT_ALIAS_IF_XXX_CONSTANT_DEF(NAME, CONSTANT, CONSTANT) #define SPROUT_INHERIT_IF_XXX_CONSTANT_DEF_LAZY(CONSTANT) \ SPROUT_INHERIT_IF_XXX_CONSTANT_DEF(SPROUT_PP_CAT(inherit_if_, CONSTANT), CONSTANT)