diff --git a/sprout/functional/inc_dec.hpp b/sprout/functional/inc_dec.hpp index c9ce3d1c..6ef8b8d0 100644 --- a/sprout/functional/inc_dec.hpp +++ b/sprout/functional/inc_dec.hpp @@ -9,9 +9,9 @@ #define SPROUT_FUNCTIONAL_INC_DEC_HPP #include -#include -#include -#include -#include +#include +#include +#include +#include #endif // #ifndef SPROUT_FUNCTIONAL_INC_DEC_HPP diff --git a/sprout/functional/mem_ptr.hpp b/sprout/functional/member_pointer.hpp similarity index 78% rename from sprout/functional/mem_ptr.hpp rename to sprout/functional/member_pointer.hpp index dc99f9f6..a7fde609 100644 --- a/sprout/functional/mem_ptr.hpp +++ b/sprout/functional/member_pointer.hpp @@ -5,8 +5,8 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ -#ifndef SPROUT_FUNCTIONAL_MEM_PTR_HPP -#define SPROUT_FUNCTIONAL_MEM_PTR_HPP +#ifndef SPROUT_FUNCTIONAL_MEMBER_POINTER_HPP +#define SPROUT_FUNCTIONAL_MEMBER_POINTER_HPP #include #include @@ -15,12 +15,12 @@ namespace sprout { // - // mem_ptr + // member_pointer // template - struct mem_ptr; + struct member_pointer; template<> - struct mem_ptr + struct member_pointer : public sprout::transparent<> { public: @@ -34,4 +34,4 @@ namespace sprout { }; } // namespace sprout -#endif // #ifndef SPROUT_FUNCTIONAL_MEM_PTR_HPP +#endif // #ifndef SPROUT_FUNCTIONAL_MEMBER_POINTER_HPP diff --git a/sprout/functional/members.hpp b/sprout/functional/members.hpp index b1e864b4..d5304dc2 100644 --- a/sprout/functional/members.hpp +++ b/sprout/functional/members.hpp @@ -9,7 +9,7 @@ #define SPROUT_FUNCTIONAL_MEMBERS_HPP #include -#include +#include #include #endif // #ifndef SPROUT_FUNCTIONAL_MEMBERS_HPP diff --git a/sprout/functional/polymorphic/inc_dec.hpp b/sprout/functional/polymorphic/inc_dec.hpp index ef7bac06..93489b1d 100644 --- a/sprout/functional/polymorphic/inc_dec.hpp +++ b/sprout/functional/polymorphic/inc_dec.hpp @@ -9,9 +9,9 @@ #define SPROUT_FUNCTIONAL_POLYMORPHIC_INC_DEC_HPP #include -#include -#include -#include -#include +#include +#include +#include +#include #endif // #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_INC_DEC_HPP diff --git a/sprout/functional/polymorphic/post_dec.hpp b/sprout/functional/polymorphic/member_pointer.hpp similarity index 55% rename from sprout/functional/polymorphic/post_dec.hpp rename to sprout/functional/polymorphic/member_pointer.hpp index 02cec6dd..5274a1c6 100644 --- a/sprout/functional/polymorphic/post_dec.hpp +++ b/sprout/functional/polymorphic/member_pointer.hpp @@ -5,21 +5,21 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ -#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_POST_DEC_HPP -#define SPROUT_FUNCTIONAL_POLYMORPHIC_POST_DEC_HPP +#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_MEMBER_POINTER_HPP +#define SPROUT_FUNCTIONAL_POLYMORPHIC_MEMBER_POINTER_HPP #include -#include +#include namespace sprout { // - // post_dec_t - // post_dec_ + // member_pointer_t + // member_pointer_ // - typedef sprout::post_dec<> post_dec_t; + typedef sprout::member_pointer<> member_pointer_t; namespace { - SPROUT_STATIC_CONSTEXPR sprout::post_dec_t post_dec_ = {}; + SPROUT_STATIC_CONSTEXPR sprout::member_pointer_t member_pointer_ = {}; } // anonymous-namespace } // namespace sprout -#endif // #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_POST_DEC_HPP +#endif // #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_MEMBER_POINTER_HPP diff --git a/sprout/functional/polymorphic/members.hpp b/sprout/functional/polymorphic/members.hpp index 2cea4c23..0f26d738 100644 --- a/sprout/functional/polymorphic/members.hpp +++ b/sprout/functional/polymorphic/members.hpp @@ -9,7 +9,7 @@ #define SPROUT_FUNCTIONAL_POLYMORPHIC_MEMBERS_HPP #include -#include +#include #include #endif // #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_MEMBERS_HPP diff --git a/sprout/functional/polymorphic/post_inc.hpp b/sprout/functional/polymorphic/post_decrement.hpp similarity index 55% rename from sprout/functional/polymorphic/post_inc.hpp rename to sprout/functional/polymorphic/post_decrement.hpp index a7e0a948..f7bac16d 100644 --- a/sprout/functional/polymorphic/post_inc.hpp +++ b/sprout/functional/polymorphic/post_decrement.hpp @@ -5,21 +5,21 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ -#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_POST_INC_HPP -#define SPROUT_FUNCTIONAL_POLYMORPHIC_POST_INC_HPP +#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_POST_DECREMENT_HPP +#define SPROUT_FUNCTIONAL_POLYMORPHIC_POST_DECREMENT_HPP #include -#include +#include namespace sprout { // - // post_inc_t - // post_inc_ + // post_decrement_t + // post_decrement_ // - typedef sprout::post_inc<> post_inc_t; + typedef sprout::post_decrement<> post_decrement_t; namespace { - SPROUT_STATIC_CONSTEXPR sprout::post_inc_t post_inc_ = {}; + SPROUT_STATIC_CONSTEXPR sprout::post_decrement_t post_decrement_ = {}; } // anonymous-namespace } // namespace sprout -#endif // #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_POST_INC_HPP +#endif // #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_POST_DECREMENT_HPP diff --git a/sprout/functional/polymorphic/post_increment.hpp b/sprout/functional/polymorphic/post_increment.hpp new file mode 100644 index 00000000..598b7be3 --- /dev/null +++ b/sprout/functional/polymorphic/post_increment.hpp @@ -0,0 +1,25 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_POST_INCREMENT_HPP +#define SPROUT_FUNCTIONAL_POLYMORPHIC_POST_INCREMENT_HPP + +#include +#include + +namespace sprout { + // + // post_increment_t + // post_increment_ + // + typedef sprout::post_increment<> post_increment_t; + namespace { + SPROUT_STATIC_CONSTEXPR sprout::post_increment_t post_increment_ = {}; + } // anonymous-namespace +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_POST_INCREMENT_HPP diff --git a/sprout/functional/polymorphic/pre_dec.hpp b/sprout/functional/polymorphic/pre_decrement.hpp similarity index 55% rename from sprout/functional/polymorphic/pre_dec.hpp rename to sprout/functional/polymorphic/pre_decrement.hpp index a9a32b08..c837d476 100644 --- a/sprout/functional/polymorphic/pre_dec.hpp +++ b/sprout/functional/polymorphic/pre_decrement.hpp @@ -5,21 +5,21 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ -#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_PRE_DEC_HPP -#define SPROUT_FUNCTIONAL_POLYMORPHIC_PRE_DEC_HPP +#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_PRE_DECREMENT_HPP +#define SPROUT_FUNCTIONAL_POLYMORPHIC_PRE_DECREMENT_HPP #include -#include +#include namespace sprout { // - // pre_dec_t - // pre_dec_ + // pre_decrement_t + // pre_decrement_ // - typedef sprout::pre_dec<> pre_dec_t; + typedef sprout::pre_decrement<> pre_decrement_t; namespace { - SPROUT_STATIC_CONSTEXPR sprout::pre_dec_t pre_dec_ = {}; + SPROUT_STATIC_CONSTEXPR sprout::pre_decrement_t pre_decrement_ = {}; } // anonymous-namespace } // namespace sprout -#endif // #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_PRE_DEC_HPP +#endif // #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_PRE_DECREMENT_HPP diff --git a/sprout/functional/polymorphic/pre_inc.hpp b/sprout/functional/polymorphic/pre_inc.hpp deleted file mode 100644 index b22676e3..00000000 --- a/sprout/functional/polymorphic/pre_inc.hpp +++ /dev/null @@ -1,25 +0,0 @@ -/*============================================================================= - Copyright (c) 2011-2016 Bolero MURAKAMI - https://github.com/bolero-MURAKAMI/Sprout - - Distributed under the Boost Software License, Version 1.0. (See accompanying - file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -=============================================================================*/ -#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_PRE_INC_HPP -#define SPROUT_FUNCTIONAL_POLYMORPHIC_PRE_INC_HPP - -#include -#include - -namespace sprout { - // - // pre_inc_t - // pre_inc_ - // - typedef sprout::pre_inc<> pre_inc_t; - namespace { - SPROUT_STATIC_CONSTEXPR sprout::pre_inc_t pre_inc_ = {}; - } // anonymous-namespace -} // namespace sprout - -#endif // #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_PRE_INC_HPP diff --git a/sprout/functional/polymorphic/mem_ptr.hpp b/sprout/functional/polymorphic/pre_increment.hpp similarity index 55% rename from sprout/functional/polymorphic/mem_ptr.hpp rename to sprout/functional/polymorphic/pre_increment.hpp index 2e40c025..129c8ce4 100644 --- a/sprout/functional/polymorphic/mem_ptr.hpp +++ b/sprout/functional/polymorphic/pre_increment.hpp @@ -5,21 +5,21 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ -#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_MEM_PTR_HPP -#define SPROUT_FUNCTIONAL_POLYMORPHIC_MEM_PTR_HPP +#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_PRE_INCREMENT_HPP +#define SPROUT_FUNCTIONAL_POLYMORPHIC_PRE_INCREMENT_HPP #include -#include +#include namespace sprout { // - // mem_ptr_t - // mem_ptr_ + // pre_increment_t + // pre_increment_ // - typedef sprout::mem_ptr<> mem_ptr_t; + typedef sprout::pre_increment<> pre_increment_t; namespace { - SPROUT_STATIC_CONSTEXPR sprout::mem_ptr_t mem_ptr_ = {}; + SPROUT_STATIC_CONSTEXPR sprout::pre_increment_t pre_increment_ = {}; } // anonymous-namespace } // namespace sprout -#endif // #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_MEM_PTR_HPP +#endif // #ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_PRE_INCREMENT_HPP diff --git a/sprout/functional/post_dec.hpp b/sprout/functional/post_decrement.hpp similarity index 67% rename from sprout/functional/post_dec.hpp rename to sprout/functional/post_decrement.hpp index de474f7c..9c284325 100644 --- a/sprout/functional/post_dec.hpp +++ b/sprout/functional/post_decrement.hpp @@ -5,8 +5,8 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ -#ifndef SPROUT_FUNCTIONAL_POST_DEC_HPP -#define SPROUT_FUNCTIONAL_POST_DEC_HPP +#ifndef SPROUT_FUNCTIONAL_POST_DECREMENT_HPP +#define SPROUT_FUNCTIONAL_POST_DECREMENT_HPP #include #include @@ -15,23 +15,23 @@ namespace sprout { // - // post_dec + // post_decrement // template - struct post_dec; + struct post_decrement; template<> - struct post_dec + struct post_decrement : public sprout::transparent<> { public: template - SPROUT_CONSTEXPR decltype(~std::declval()--) + SPROUT_CONSTEXPR decltype(std::declval()--) operator()(T&& x) - const SPROUT_NOEXCEPT_IF_EXPR(~std::declval()--) + const SPROUT_NOEXCEPT_IF_EXPR(std::declval()--) { return SPROUT_FORWARD(T, x)--; } }; } // namespace sprout -#endif // #ifndef SPROUT_FUNCTIONAL_POST_DEC_HPP +#endif // #ifndef SPROUT_FUNCTIONAL_POST_DECREMENT_HPP diff --git a/sprout/functional/post_inc.hpp b/sprout/functional/post_increment.hpp similarity index 77% rename from sprout/functional/post_inc.hpp rename to sprout/functional/post_increment.hpp index f74fec33..230b0920 100644 --- a/sprout/functional/post_inc.hpp +++ b/sprout/functional/post_increment.hpp @@ -5,8 +5,8 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ -#ifndef SPROUT_FUNCTIONAL_POST_INC_HPP -#define SPROUT_FUNCTIONAL_POST_INC_HPP +#ifndef SPROUT_FUNCTIONAL_POST_INCREMENT_HPP +#define SPROUT_FUNCTIONAL_POST_INCREMENT_HPP #include #include @@ -15,12 +15,12 @@ namespace sprout { // - // post_inc + // post_increment // template - struct post_inc; + struct post_increment; template<> - struct post_inc + struct post_increment : public sprout::transparent<> { public: @@ -34,4 +34,4 @@ namespace sprout { }; } // namespace sprout -#endif // #ifndef SPROUT_FUNCTIONAL_POST_INC_HPP +#endif // #ifndef SPROUT_FUNCTIONAL_POST_INCREMENT_HPP diff --git a/sprout/functional/pre_dec.hpp b/sprout/functional/pre_decrement.hpp similarity index 77% rename from sprout/functional/pre_dec.hpp rename to sprout/functional/pre_decrement.hpp index 39be5559..c4ba16cc 100644 --- a/sprout/functional/pre_dec.hpp +++ b/sprout/functional/pre_decrement.hpp @@ -5,8 +5,8 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ -#ifndef SPROUT_FUNCTIONAL_PRE_DEC_HPP -#define SPROUT_FUNCTIONAL_PRE_DEC_HPP +#ifndef SPROUT_FUNCTIONAL_PRE_DECREMENT_HPP +#define SPROUT_FUNCTIONAL_PRE_DECREMENT_HPP #include #include @@ -15,12 +15,12 @@ namespace sprout { // - // pre_dec + // pre_decrement // template - struct pre_dec; + struct pre_decrement; template<> - struct pre_dec + struct pre_decrement : public sprout::transparent<> { public: @@ -34,4 +34,4 @@ namespace sprout { }; } // namespace sprout -#endif // #ifndef SPROUT_FUNCTIONAL_PRE_DEC_HPP +#endif // #ifndef SPROUT_FUNCTIONAL_PRE_DECREMENT_HPP diff --git a/sprout/functional/pre_inc.hpp b/sprout/functional/pre_increment.hpp similarity index 77% rename from sprout/functional/pre_inc.hpp rename to sprout/functional/pre_increment.hpp index 1d17f5d0..448da651 100644 --- a/sprout/functional/pre_inc.hpp +++ b/sprout/functional/pre_increment.hpp @@ -5,8 +5,8 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ -#ifndef SPROUT_FUNCTIONAL_PRE_INC_HPP -#define SPROUT_FUNCTIONAL_PRE_INC_HPP +#ifndef SPROUT_FUNCTIONAL_PRE_INCREMENT_HPP +#define SPROUT_FUNCTIONAL_PRE_INCREMENT_HPP #include #include @@ -15,12 +15,12 @@ namespace sprout { // - // pre_inc + // pre_increment // template - struct pre_inc; + struct pre_increment; template<> - struct pre_inc + struct pre_increment : public sprout::transparent<> { public: @@ -34,4 +34,4 @@ namespace sprout { }; } // namespace sprout -#endif // #ifndef SPROUT_FUNCTIONAL_PRE_INC_HPP +#endif // #ifndef SPROUT_FUNCTIONAL_PRE_INCREMENT_HPP diff --git a/sprout/preprocessor/comma.hpp b/sprout/preprocessor/comma.hpp new file mode 100644 index 00000000..3c2661a7 --- /dev/null +++ b/sprout/preprocessor/comma.hpp @@ -0,0 +1,18 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_PREPROCESSOR_COMMA_HPP +#define SPROUT_PREPROCESSOR_COMMA_HPP + +#include + +// +// SPROUT_PP_COMMA +// +#define SPROUT_PP_COMMA() , + +#endif // #ifndef SPROUT_PREPROCESSOR_COMMA_HPP diff --git a/sprout/type_traits/copy_const.hpp b/sprout/type_traits/copy_const.hpp index 41d20f1e..8da412a8 100644 --- a/sprout/type_traits/copy_const.hpp +++ b/sprout/type_traits/copy_const.hpp @@ -22,7 +22,7 @@ namespace sprout { {}; template struct copy_const - : public std::add_volatile + : public std::add_const {}; #if SPROUT_USE_TEMPLATE_ALIASES diff --git a/sprout/type_traits/detail/has_binary_op.hpp b/sprout/type_traits/detail/has_binary_op.hpp index c988c58e..fdc4453e 100644 --- a/sprout/type_traits/detail/has_binary_op.hpp +++ b/sprout/type_traits/detail/has_binary_op.hpp @@ -16,13 +16,19 @@ #include #include -#define SPROUT_DETAIL_HAS_BINARY_OP_DECL(OP_NAME, OP) \ +#define SPROUT_DETAIL_HAS_BINARY_OP_INFIX_EXPR(OP, LHS, RHS) \ + LHS OP RHS + +#define SPROUT_DETAIL_HAS_BINARY_OP_DECL(OP_NAME, OP, RHS_DEFAULT) \ + SPROUT_DETAIL_HAS_BINARY_OP_DECL_(OP_NAME, OP, RHS_DEFAULT, SPROUT_DETAIL_HAS_BINARY_OP_INFIX_EXPR) + +#define SPROUT_DETAIL_HAS_BINARY_OP_DECL_(OP_NAME, OP, RHS_DEFAULT, EXPR) \ template \ struct SPROUT_PP_CAT(sprout_detail_has_, SPROUT_PP_CAT(OP_NAME, _test)) { \ public: \ template< \ typename U1 = T1, typename U2 = T2, \ - typename Result = sprout::bool_constant() OP std::declval())>::type, R>::value> \ + typename Result = sprout::bool_constant(), std::declval()))>::type, R>::value> \ > \ static Result test(int); \ static sprout::false_type test(...); \ @@ -32,20 +38,23 @@ public: \ template< \ typename U1 = T1, typename U2 = T2, \ - typename typename sprout::identity() OP std::declval())>::type \ + typename = typename sprout::identity(), std::declval()))>::type \ > \ static sprout::true_type test(int); \ static sprout::false_type test(...); \ }; \ SPROUT_DETAIL_HAS_BINARY_OP_DECL_IMPL(OP_NAME); \ - template \ + template \ struct SPROUT_PP_CAT(has_, OP_NAME) \ : public SPROUT_PP_CAT(sprout_detail_has_, OP_NAME) \ {} #if defined(_MSC_VER) && (_MSC_VER > 1900) # define SPROUT_DETAIL_HAS_BINARY_OP_DECL_IMPL(OP_NAME) \ - template::test(0))>::type> \ + template< \ + typename T, typename U, typename R, \ + typename Base_ = typename sprout::identity::test(0))>::type \ + > \ struct SPROUT_PP_CAT(sprout_detail_has_, OP_NAME) \ : public Base_ \ {} @@ -53,7 +62,7 @@ # define SPROUT_DETAIL_HAS_BINARY_OP_DECL_IMPL(OP_NAME) \ template \ struct SPROUT_PP_CAT(sprout_detail_has_, OP_NAME) \ - : public sprout::identity::test(0))>::type \ + : public sprout::identity::test(0))>::type \ {} #endif diff --git a/sprout/type_traits/detail/has_post_unary_op.hpp b/sprout/type_traits/detail/has_post_unary_op.hpp index dd1761b9..e1b002c2 100644 --- a/sprout/type_traits/detail/has_post_unary_op.hpp +++ b/sprout/type_traits/detail/has_post_unary_op.hpp @@ -32,7 +32,7 @@ public: \ template< \ typename U = T, \ - typename typename sprout::identity() OP)>::type \ + typename = typename sprout::identity() OP)>::type \ > \ static sprout::true_type test(int); \ static sprout::false_type test(...); \ @@ -45,7 +45,10 @@ #if defined(_MSC_VER) && (_MSC_VER > 1900) # define SPROUT_DETAIL_HAS_POST_UNARY_OP_DECL_IMPL(OP_NAME) \ - template::test(0))>::type> \ + template< \ + typename T, typename R, \ + typename Base_ = typename sprout::identity::test(0))>::type \ + > \ struct SPROUT_PP_CAT(sprout_detail_has_, OP_NAME) \ : public Base_ \ {} @@ -53,7 +56,7 @@ # define SPROUT_DETAIL_HAS_POST_UNARY_OP_DECL_IMPL(OP_NAME) \ template \ struct SPROUT_PP_CAT(sprout_detail_has_, OP_NAME) \ - : public sprout::identity::test(0))>::type \ + : public sprout::identity::test(0))>::type \ {} #endif diff --git a/sprout/type_traits/detail/has_pre_unary_op.hpp b/sprout/type_traits/detail/has_pre_unary_op.hpp index 05b570f0..910639ee 100644 --- a/sprout/type_traits/detail/has_pre_unary_op.hpp +++ b/sprout/type_traits/detail/has_pre_unary_op.hpp @@ -32,7 +32,7 @@ public: \ template< \ typename U = T, \ - typename typename sprout::identity())>::type \ + typename = typename sprout::identity())>::type \ > \ static sprout::true_type test(int); \ static sprout::false_type test(...); \ @@ -45,7 +45,10 @@ #if defined(_MSC_VER) && (_MSC_VER > 1900) # define SPROUT_DETAIL_HAS_PRE_UNARY_OP_DECL_IMPL(OP_NAME) \ - template::test(0))>::type> \ + template< \ + typename T, typename R, \ + typename Base_ = typename sprout::identity::test(0))>::type \ + > \ struct SPROUT_PP_CAT(sprout_detail_has_, OP_NAME) \ : public Base_ \ {} @@ -53,7 +56,7 @@ # define SPROUT_DETAIL_HAS_PRE_UNARY_OP_DECL_IMPL(OP_NAME) \ template \ struct SPROUT_PP_CAT(sprout_detail_has_, OP_NAME) \ - : public sprout::identity::test(0))>::type \ + : public sprout::identity::test(0))>::type \ {} #endif diff --git a/sprout/type_traits/detail/has_subscript_op.hpp b/sprout/type_traits/detail/has_subscript_op.hpp new file mode 100644 index 00000000..b66f72e8 --- /dev/null +++ b/sprout/type_traits/detail/has_subscript_op.hpp @@ -0,0 +1,21 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_DETAIL_HAS_SUBSCRIPT_OP_HPP +#define SPROUT_TYPE_TRAITS_DETAIL_HAS_SUBSCRIPT_OP_HPP + +#include +#include + +#define SPROUT_DETAIL_HAS_OP_SUBSCRIPT_EXPR(OP, LHS, RHS) \ + LHS[RHS] + +#define SPROUT_DETAIL_HAS_SUBSCRIPT_OP_DECL(OP_NAME, OP, RHS_DEFAULT) \ + SPROUT_DETAIL_HAS_BINARY_OP_DECL_(OP_NAME, OP, RHS_DEFAULT, SPROUT_DETAIL_HAS_OP_SUBSCRIPT_EXPR) + + +#endif // #ifndef SPROUT_TYPE_TRAITS_DETAIL_HAS_SUBSCRIPT_OP_HPP diff --git a/sprout/type_traits/enabler_if.hpp b/sprout/type_traits/enabler_if.hpp index f65ec54f..7a95437a 100644 --- a/sprout/type_traits/enabler_if.hpp +++ b/sprout/type_traits/enabler_if.hpp @@ -17,15 +17,24 @@ namespace sprout { // enabler // typedef void* enabler_t; +#if defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC) namespace { SPROUT_STATIC_CONSTEXPR sprout::enabler_t enabler = {}; } // anonymous-namespace +#else + extern enabler_t enabler; +#endif + // // enabler_if // template class enabler_if +#if defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC) : public std::enable_if +#else + : public std::enable_if +#endif {}; // // disabler_if diff --git a/sprout/type_traits/has_address_of.hpp b/sprout/type_traits/has_address_of.hpp new file mode 100644 index 00000000..3f4efebf --- /dev/null +++ b/sprout/type_traits/has_address_of.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_ADDRESS_OF_HPP +#define SPROUT_TYPE_TRAITS_HAS_ADDRESS_OF_HPP + +#include +#include +#include + +namespace sprout { + // + // has_address_of + // + SPROUT_DETAIL_HAS_PRE_UNARY_OP_DECL(address_of, &); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_address_of_v = sprout::has_address_of::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_ADDRESS_OF_HPP diff --git a/sprout/type_traits/has_assign.hpp b/sprout/type_traits/has_assign.hpp index 41fd3ac4..a3087d57 100644 --- a/sprout/type_traits/has_assign.hpp +++ b/sprout/type_traits/has_assign.hpp @@ -8,19 +8,19 @@ #ifndef SPROUT_TYPE_TRAITS_HAS_ASSIGN_HPP #define SPROUT_TYPE_TRAITS_HAS_ASSIGN_HPP -#include #include #include +#include #include namespace sprout { // // has_assign // - SPROUT_DETAIL_HAS_BINARY_OP_DECL(has_assign, =); + SPROUT_DETAIL_HAS_BINARY_OP_DECL(assign, =, = typename sprout::const_reference::type); #if SPROUT_USE_VARIABLE_TEMPLATES - template + template::type, typename R = sprout::dont_care> SPROUT_STATIC_CONSTEXPR bool has_assign_v = sprout::has_assign::value; #endif // #if SPROUT_USE_VARIABLE_TEMPLATES } // namespace sprout diff --git a/sprout/type_traits/has_bit_and.hpp b/sprout/type_traits/has_bit_and.hpp new file mode 100644 index 00000000..6525ca8b --- /dev/null +++ b/sprout/type_traits/has_bit_and.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_BIT_AND_HPP +#define SPROUT_TYPE_TRAITS_HAS_BIT_AND_HPP + +#include +#include +#include + +namespace sprout { + // + // has_bit_and + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(bit_and, &, = T); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_bit_and_v = sprout::has_bit_and::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_BIT_AND_HPP diff --git a/sprout/type_traits/has_bit_and_assign.hpp b/sprout/type_traits/has_bit_and_assign.hpp new file mode 100644 index 00000000..1f743b96 --- /dev/null +++ b/sprout/type_traits/has_bit_and_assign.hpp @@ -0,0 +1,28 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_BIT_AND_ASSIGN_HPP +#define SPROUT_TYPE_TRAITS_HAS_BIT_AND_ASSIGN_HPP + +#include +#include +#include +#include + +namespace sprout { + // + // has_bit_and_assign + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(bit_and_assign, =, = typename sprout::const_reference::type); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template::type, typename R = sprout::dont_care> + SPROUT_STATIC_CONSTEXPR bool has_bit_and_assign_v = sprout::has_bit_and_assign::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_BIT_AND_ASSIGN_HPP diff --git a/sprout/type_traits/has_bit_not.hpp b/sprout/type_traits/has_bit_not.hpp new file mode 100644 index 00000000..d35cc384 --- /dev/null +++ b/sprout/type_traits/has_bit_not.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_BIT_NOT_HPP +#define SPROUT_TYPE_TRAITS_HAS_BIT_NOT_HPP + +#include +#include +#include + +namespace sprout { + // + // has_bit_not + // + SPROUT_DETAIL_HAS_PRE_UNARY_OP_DECL(bit_not, ~); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_bit_not_v = sprout::has_bit_not::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_BIT_NOT_HPP diff --git a/sprout/type_traits/has_bit_or.hpp b/sprout/type_traits/has_bit_or.hpp new file mode 100644 index 00000000..25c09e56 --- /dev/null +++ b/sprout/type_traits/has_bit_or.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_BIT_OR_HPP +#define SPROUT_TYPE_TRAITS_HAS_BIT_OR_HPP + +#include +#include +#include + +namespace sprout { + // + // has_bit_or + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(bit_or, |, = T); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_bit_or_v = sprout::has_bit_or::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_BIT_OR_HPP diff --git a/sprout/type_traits/has_bit_or_assign.hpp b/sprout/type_traits/has_bit_or_assign.hpp new file mode 100644 index 00000000..c248880d --- /dev/null +++ b/sprout/type_traits/has_bit_or_assign.hpp @@ -0,0 +1,28 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_BIT_OR_ASSIGN_HPP +#define SPROUT_TYPE_TRAITS_HAS_BIT_OR_ASSIGN_HPP + +#include +#include +#include +#include + +namespace sprout { + // + // has_bit_or_assign + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(bit_or_assign, =, = typename sprout::const_reference::type); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template::type, typename R = sprout::dont_care> + SPROUT_STATIC_CONSTEXPR bool has_bit_or_assign_v = sprout::has_bit_or_assign::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_BIT_OR_ASSIGN_HPP diff --git a/sprout/type_traits/has_bit_xor.hpp b/sprout/type_traits/has_bit_xor.hpp new file mode 100644 index 00000000..85d86c10 --- /dev/null +++ b/sprout/type_traits/has_bit_xor.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_BIT_XOR_HPP +#define SPROUT_TYPE_TRAITS_HAS_BIT_XOR_HPP + +#include +#include +#include + +namespace sprout { + // + // has_bit_xor + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(bit_xor, ^, = T); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_bit_xor_v = sprout::has_bit_xor::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_BIT_XOR_HPP diff --git a/sprout/type_traits/has_bit_xor_assign.hpp b/sprout/type_traits/has_bit_xor_assign.hpp new file mode 100644 index 00000000..18283574 --- /dev/null +++ b/sprout/type_traits/has_bit_xor_assign.hpp @@ -0,0 +1,28 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_BIT_XOR_ASSIGN_HPP +#define SPROUT_TYPE_TRAITS_HAS_BIT_XOR_ASSIGN_HPP + +#include +#include +#include +#include + +namespace sprout { + // + // has_bit_xor_assign + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(bit_xor_assign, =, = typename sprout::const_reference::type); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template::type, typename R = sprout::dont_care> + SPROUT_STATIC_CONSTEXPR bool has_bit_xor_assign_v = sprout::has_bit_xor_assign::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_BIT_XOR_ASSIGN_HPP diff --git a/sprout/type_traits/has_comma.hpp b/sprout/type_traits/has_comma.hpp new file mode 100644 index 00000000..0df6d8f6 --- /dev/null +++ b/sprout/type_traits/has_comma.hpp @@ -0,0 +1,28 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_PLUS_HPP +#define SPROUT_TYPE_TRAITS_HAS_PLUS_HPP + +#include +#include +#include +#include + +namespace sprout { + // + // has_comma + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(comma, SPROUT_PP_COMMA(), = T); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_comma_v = sprout::has_comma::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_PLUS_HPP diff --git a/sprout/type_traits/has_complement.hpp b/sprout/type_traits/has_complement.hpp new file mode 100644 index 00000000..9a0c494e --- /dev/null +++ b/sprout/type_traits/has_complement.hpp @@ -0,0 +1,30 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_COMPLEMENT_HPP +#define SPROUT_TYPE_TRAITS_HAS_COMPLEMENT_HPP + +#include +#include +#include + +namespace sprout { + // + // has_complement + // + template + struct has_complement + : public sprout::has_bit_not + {}; + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_complement_v = sprout::has_complement::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_COMPLEMENT_HPP diff --git a/sprout/type_traits/has_dereference.hpp b/sprout/type_traits/has_dereference.hpp new file mode 100644 index 00000000..f14f1588 --- /dev/null +++ b/sprout/type_traits/has_dereference.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_DEREFERENCE_HPP +#define SPROUT_TYPE_TRAITS_HAS_DEREFERENCE_HPP + +#include +#include +#include + +namespace sprout { + // + // has_dereference + // + SPROUT_DETAIL_HAS_PRE_UNARY_OP_DECL(dereference, *); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_dereference_v = sprout::has_dereference::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_DEREFERENCE_HPP diff --git a/sprout/type_traits/has_divides.hpp b/sprout/type_traits/has_divides.hpp new file mode 100644 index 00000000..a45a4a56 --- /dev/null +++ b/sprout/type_traits/has_divides.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_DIVIDES_HPP +#define SPROUT_TYPE_TRAITS_HAS_DIVIDES_HPP + +#include +#include +#include + +namespace sprout { + // + // has_divides + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(divides, /, = T); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_divides_v = sprout::has_divides::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_DIVIDES_HPP diff --git a/sprout/type_traits/has_divides_assign.hpp b/sprout/type_traits/has_divides_assign.hpp new file mode 100644 index 00000000..e0e1b356 --- /dev/null +++ b/sprout/type_traits/has_divides_assign.hpp @@ -0,0 +1,28 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_DIVIDES_ASSIGN_HPP +#define SPROUT_TYPE_TRAITS_HAS_DIVIDES_ASSIGN_HPP + +#include +#include +#include +#include + +namespace sprout { + // + // has_divides_assign + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(divides_assign, /=, = typename sprout::const_reference::type); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template::type, typename R = sprout::dont_care> + SPROUT_STATIC_CONSTEXPR bool has_divides_assign_v = sprout::has_divides_assign::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_DIVIDES_ASSIGN_HPP diff --git a/sprout/type_traits/has_equal_to.hpp b/sprout/type_traits/has_equal_to.hpp new file mode 100644 index 00000000..d84e3c8d --- /dev/null +++ b/sprout/type_traits/has_equal_to.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_EQUAL_TO_HPP +#define SPROUT_TYPE_TRAITS_HAS_EQUAL_TO_HPP + +#include +#include +#include + +namespace sprout { + // + // has_equal_to + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(equal_to, ==, = T); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_equal_to_v = sprout::has_equal_to::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_EQUAL_TO_HPP diff --git a/sprout/type_traits/has_greater.hpp b/sprout/type_traits/has_greater.hpp new file mode 100644 index 00000000..e6ade55a --- /dev/null +++ b/sprout/type_traits/has_greater.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_GREATER_HPP +#define SPROUT_TYPE_TRAITS_HAS_GREATER_HPP + +#include +#include +#include + +namespace sprout { + // + // has_greater + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(greater, >, = T); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_greater_v = sprout::has_greater::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_GREATER_HPP diff --git a/sprout/type_traits/has_greater_equal.hpp b/sprout/type_traits/has_greater_equal.hpp new file mode 100644 index 00000000..b224912e --- /dev/null +++ b/sprout/type_traits/has_greater_equal.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_GREATER_EQUAL_HPP +#define SPROUT_TYPE_TRAITS_HAS_GREATER_EQUAL_HPP + +#include +#include +#include + +namespace sprout { + // + // has_greater_equal + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(greater_equal, >=, = T); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_greater_equal_v = sprout::has_greater_equal::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_GREATER_EQUAL_HPP diff --git a/sprout/type_traits/has_left_shift.hpp b/sprout/type_traits/has_left_shift.hpp new file mode 100644 index 00000000..56e9f17d --- /dev/null +++ b/sprout/type_traits/has_left_shift.hpp @@ -0,0 +1,30 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_LEFT_SHIFT_HPP +#define SPROUT_TYPE_TRAITS_HAS_LEFT_SHIFT_HPP + +#include +#include +#include + +namespace sprout { + // + // has_left_shift + // + template + struct has_left_shift + : public sprout::has_shift_left + {}; + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_left_shift_v = sprout::has_left_shift::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_LEFT_SHIFT_HPP diff --git a/sprout/type_traits/has_left_shift_assign.hpp b/sprout/type_traits/has_left_shift_assign.hpp new file mode 100644 index 00000000..92712e0e --- /dev/null +++ b/sprout/type_traits/has_left_shift_assign.hpp @@ -0,0 +1,30 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_SHIFT_LEFT_ASSIGN_HPP +#define SPROUT_TYPE_TRAITS_HAS_SHIFT_LEFT_ASSIGN_HPP + +#include +#include +#include + +namespace sprout { + // + // has_left_shift_assign + // + template::type, typename R = sprout::dont_care> + struct has_left_shift_assign + : public sprout::has_shift_left + {}; + +#if SPROUT_USE_VARIABLE_TEMPLATES + template::type, typename R = sprout::dont_care> + SPROUT_STATIC_CONSTEXPR bool has_left_shift_assign_v = sprout::has_left_shift_assign::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_SHIFT_LEFT_ASSIGN_HPP diff --git a/sprout/type_traits/has_less.hpp b/sprout/type_traits/has_less.hpp new file mode 100644 index 00000000..5efb3f08 --- /dev/null +++ b/sprout/type_traits/has_less.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_LESS_HPP +#define SPROUT_TYPE_TRAITS_HAS_LESS_HPP + +#include +#include +#include + +namespace sprout { + // + // has_less + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(less, <, = T); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_less_v = sprout::has_less::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_LESS_HPP diff --git a/sprout/type_traits/has_less_equal.hpp b/sprout/type_traits/has_less_equal.hpp new file mode 100644 index 00000000..3c86f598 --- /dev/null +++ b/sprout/type_traits/has_less_equal.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_LESS_EQUAL_HPP +#define SPROUT_TYPE_TRAITS_HAS_LESS_EQUAL_HPP + +#include +#include +#include + +namespace sprout { + // + // has_less_equal + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(less_equal, <=, = T); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_less_equal_v = sprout::has_less_equal::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_LESS_EQUAL_HPP diff --git a/sprout/type_traits/has_logical_and.hpp b/sprout/type_traits/has_logical_and.hpp new file mode 100644 index 00000000..c8fb6c92 --- /dev/null +++ b/sprout/type_traits/has_logical_and.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_LOGICAL_AND_HPP +#define SPROUT_TYPE_TRAITS_HAS_LOGICAL_AND_HPP + +#include +#include +#include + +namespace sprout { + // + // has_logical_and + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(logical_and, &&, = T); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_logical_and_v = sprout::has_logical_and::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_LOGICAL_AND_HPP diff --git a/sprout/type_traits/has_logical_not.hpp b/sprout/type_traits/has_logical_not.hpp new file mode 100644 index 00000000..f77a5033 --- /dev/null +++ b/sprout/type_traits/has_logical_not.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_LOGICAL_NOT_HPP +#define SPROUT_TYPE_TRAITS_HAS_LOGICAL_NOT_HPP + +#include +#include +#include + +namespace sprout { + // + // has_logical_not + // + SPROUT_DETAIL_HAS_PRE_UNARY_OP_DECL(logical_not, !); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_logical_not_v = sprout::has_logical_not::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_LOGICAL_NOT_HPP diff --git a/sprout/type_traits/has_logical_or.hpp b/sprout/type_traits/has_logical_or.hpp new file mode 100644 index 00000000..88a93761 --- /dev/null +++ b/sprout/type_traits/has_logical_or.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_LOGICAL_OR_HPP +#define SPROUT_TYPE_TRAITS_HAS_LOGICAL_OR_HPP + +#include +#include +#include + +namespace sprout { + // + // has_logical_or + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(logical_or, ||, = T); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_logical_or_v = sprout::has_logical_or::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_LOGICAL_OR_HPP diff --git a/sprout/type_traits/has_member.hpp b/sprout/type_traits/has_member.hpp new file mode 100644 index 00000000..b004e16f --- /dev/null +++ b/sprout/type_traits/has_member.hpp @@ -0,0 +1,28 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_MEMBER_HPP +#define SPROUT_TYPE_TRAITS_HAS_MEMBER_HPP + +#include +#include +#include +#include + +namespace sprout { + // + // has_member + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(member, .*, SPROUT_PP_EMPTY()); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_member_v = sprout::has_member::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_MEMBER_HPP diff --git a/sprout/type_traits/has_member_pointer.hpp b/sprout/type_traits/has_member_pointer.hpp new file mode 100644 index 00000000..9b8a79e1 --- /dev/null +++ b/sprout/type_traits/has_member_pointer.hpp @@ -0,0 +1,28 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_MEMBER_POINTER_HPP +#define SPROUT_TYPE_TRAITS_HAS_MEMBER_POINTER_HPP + +#include +#include +#include +#include + +namespace sprout { + // + // has_member_pointer + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(member_pointer, ->*, SPROUT_PP_EMPTY()); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_member_pointer_v = sprout::has_member_pointer::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_MEMBER_POINTER_HPP diff --git a/sprout/type_traits/has_minus.hpp b/sprout/type_traits/has_minus.hpp new file mode 100644 index 00000000..929683ff --- /dev/null +++ b/sprout/type_traits/has_minus.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_MINUS_HPP +#define SPROUT_TYPE_TRAITS_HAS_MINUS_HPP + +#include +#include +#include + +namespace sprout { + // + // has_minus + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(minus, -, = T); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_minus_v = sprout::has_minus::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_MINUS_HPP diff --git a/sprout/type_traits/has_minus_assign.hpp b/sprout/type_traits/has_minus_assign.hpp new file mode 100644 index 00000000..d7f5a438 --- /dev/null +++ b/sprout/type_traits/has_minus_assign.hpp @@ -0,0 +1,28 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_MINUS_ASSIGN_HPP +#define SPROUT_TYPE_TRAITS_HAS_MINUS_ASSIGN_HPP + +#include +#include +#include +#include + +namespace sprout { + // + // has_minus_assign + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(minus_assign, -=, = typename sprout::const_reference::type); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template::type, typename R = sprout::dont_care> + SPROUT_STATIC_CONSTEXPR bool has_minus_assign_v = sprout::has_minus_assign::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_MINUS_ASSIGN_HPP diff --git a/sprout/type_traits/has_modulus.hpp b/sprout/type_traits/has_modulus.hpp new file mode 100644 index 00000000..b625e3ef --- /dev/null +++ b/sprout/type_traits/has_modulus.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_MODULUS_HPP +#define SPROUT_TYPE_TRAITS_HAS_MODULUS_HPP + +#include +#include +#include + +namespace sprout { + // + // has_modulus + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(modulus, %, = T); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_modulus_v = sprout::has_modulus::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_MODULUS_HPP diff --git a/sprout/type_traits/has_modulus_assign.hpp b/sprout/type_traits/has_modulus_assign.hpp new file mode 100644 index 00000000..40ef4348 --- /dev/null +++ b/sprout/type_traits/has_modulus_assign.hpp @@ -0,0 +1,28 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_MODULUS_ASSIGN_HPP +#define SPROUT_TYPE_TRAITS_HAS_MODULUS_ASSIGN_HPP + +#include +#include +#include +#include + +namespace sprout { + // + // has_modulus_assign + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(modulus_assign, %=, = typename sprout::const_reference::type); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template::type, typename R = sprout::dont_care> + SPROUT_STATIC_CONSTEXPR bool has_modulus_assign_v = sprout::has_modulus_assign::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_MODULUS_ASSIGN_HPP diff --git a/sprout/type_traits/has_multiplies.hpp b/sprout/type_traits/has_multiplies.hpp new file mode 100644 index 00000000..8d0289e2 --- /dev/null +++ b/sprout/type_traits/has_multiplies.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_MULTIPLIES_HPP +#define SPROUT_TYPE_TRAITS_HAS_MULTIPLIES_HPP + +#include +#include +#include + +namespace sprout { + // + // has_multiplies + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(multiplies, *, = T); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_multiplies_v = sprout::has_multiplies::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_MULTIPLIES_HPP diff --git a/sprout/type_traits/has_multiplies_assign.hpp b/sprout/type_traits/has_multiplies_assign.hpp new file mode 100644 index 00000000..d86be0b6 --- /dev/null +++ b/sprout/type_traits/has_multiplies_assign.hpp @@ -0,0 +1,28 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_MULTIPLIES_ASSIGN_HPP +#define SPROUT_TYPE_TRAITS_HAS_MULTIPLIES_ASSIGN_HPP + +#include +#include +#include +#include + +namespace sprout { + // + // has_multiplies_assign + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(multiplies_assign, *=, = typename sprout::const_reference::type); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template::type, typename R = sprout::dont_care> + SPROUT_STATIC_CONSTEXPR bool has_multiplies_assign_v = sprout::has_multiplies_assign::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_MULTIPLIES_ASSIGN_HPP diff --git a/sprout/type_traits/has_negate.hpp b/sprout/type_traits/has_negate.hpp new file mode 100644 index 00000000..96a75623 --- /dev/null +++ b/sprout/type_traits/has_negate.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_NEGATE_HPP +#define SPROUT_TYPE_TRAITS_HAS_NEGATE_HPP + +#include +#include +#include + +namespace sprout { + // + // has_negate + // + SPROUT_DETAIL_HAS_PRE_UNARY_OP_DECL(negate, -); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_negate_v = sprout::has_negate::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_NEGATE_HPP diff --git a/sprout/type_traits/has_not_equal_to.hpp b/sprout/type_traits/has_not_equal_to.hpp new file mode 100644 index 00000000..b67a5bb2 --- /dev/null +++ b/sprout/type_traits/has_not_equal_to.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_NOT_EQUAL_TO_HPP +#define SPROUT_TYPE_TRAITS_HAS_NOT_EQUAL_TO_HPP + +#include +#include +#include + +namespace sprout { + // + // has_not_equal_to + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(not_equal_to, !=, = T); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_not_equal_to_v = sprout::has_not_equal_to::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_NOT_EQUAL_TO_HPP diff --git a/sprout/type_traits/has_operator.hpp b/sprout/type_traits/has_operator.hpp index 9e6d66df..9fa0a1f8 100644 --- a/sprout/type_traits/has_operator.hpp +++ b/sprout/type_traits/has_operator.hpp @@ -5,10 +5,68 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ -#ifndef SPROUT_TYPE_TRAITS_LOGICAL_HPP -#define SPROUT_TYPE_TRAITS_LOGICAL_HPP +#ifndef SPROUT_TYPE_TRAITS_HAS_OPERATOR_HPP +#define SPROUT_TYPE_TRAITS_HAS_OPERATOR_HPP #include +// arithmetic +#include +#include +#include +#include +#include +#include +#include +#include +#include +// comparison +#include +#include +#include +#include +#include +#include +// logical +#include +#include +#include +// bitwise +#include +#include +#include +#include +#include +#include +#include +#include +#include +// inc_dec +#include +#include +#include +#include +// reference +#include +#include +// assignment #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// members +#include +#include +// various +#include +#include -#endif // #ifndef SPROUT_TYPE_TRAITS_LOGICAL_HPP +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_OPERATOR_HPP diff --git a/sprout/type_traits/has_plus.hpp b/sprout/type_traits/has_plus.hpp new file mode 100644 index 00000000..6d28d523 --- /dev/null +++ b/sprout/type_traits/has_plus.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_PLUS_HPP +#define SPROUT_TYPE_TRAITS_HAS_PLUS_HPP + +#include +#include +#include + +namespace sprout { + // + // has_plus + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(plus, +, = T); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_plus_v = sprout::has_plus::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_PLUS_HPP diff --git a/sprout/type_traits/has_plus_assign.hpp b/sprout/type_traits/has_plus_assign.hpp new file mode 100644 index 00000000..a84aa921 --- /dev/null +++ b/sprout/type_traits/has_plus_assign.hpp @@ -0,0 +1,28 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_PLUS_ASSIGN_HPP +#define SPROUT_TYPE_TRAITS_HAS_PLUS_ASSIGN_HPP + +#include +#include +#include +#include + +namespace sprout { + // + // has_plus_assign + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(plus_assign, +=, = typename sprout::const_reference::type); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template::type, typename R = sprout::dont_care> + SPROUT_STATIC_CONSTEXPR bool has_plus_assign_v = sprout::has_plus_assign::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_PLUS_ASSIGN_HPP diff --git a/sprout/type_traits/has_posite.hpp b/sprout/type_traits/has_posite.hpp new file mode 100644 index 00000000..50887572 --- /dev/null +++ b/sprout/type_traits/has_posite.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_POSITE_HPP +#define SPROUT_TYPE_TRAITS_HAS_POSITE_HPP + +#include +#include +#include + +namespace sprout { + // + // has_posite + // + SPROUT_DETAIL_HAS_PRE_UNARY_OP_DECL(posite, +); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_posite_v = sprout::has_posite::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_POSITE_HPP diff --git a/sprout/type_traits/has_post_decrement.hpp b/sprout/type_traits/has_post_decrement.hpp new file mode 100644 index 00000000..120c4cff --- /dev/null +++ b/sprout/type_traits/has_post_decrement.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_POST_DECREMENT_HPP +#define SPROUT_TYPE_TRAITS_HAS_POST_DECREMENT_HPP + +#include +#include +#include + +namespace sprout { + // + // has_post_decrement + // + SPROUT_DETAIL_HAS_PRE_UNARY_OP_DECL(post_decrement, --); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_post_decrement_v = sprout::has_post_decrement::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_POST_DECREMENT_HPP diff --git a/sprout/type_traits/has_post_increment.hpp b/sprout/type_traits/has_post_increment.hpp new file mode 100644 index 00000000..63ddbf64 --- /dev/null +++ b/sprout/type_traits/has_post_increment.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_POST_INCREMENT_HPP +#define SPROUT_TYPE_TRAITS_HAS_POST_INCREMENT_HPP + +#include +#include +#include + +namespace sprout { + // + // has_post_increment + // + SPROUT_DETAIL_HAS_POST_UNARY_OP_DECL(post_increment, ++); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_post_increment_v = sprout::has_post_increment::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_POST_INCREMENT_HPP diff --git a/sprout/type_traits/has_pre_decrement.hpp b/sprout/type_traits/has_pre_decrement.hpp new file mode 100644 index 00000000..e14688eb --- /dev/null +++ b/sprout/type_traits/has_pre_decrement.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_PRE_DECREMENT_HPP +#define SPROUT_TYPE_TRAITS_HAS_PRE_DECREMENT_HPP + +#include +#include +#include + +namespace sprout { + // + // has_pre_decrement + // + SPROUT_DETAIL_HAS_PRE_UNARY_OP_DECL(pre_decrement, ++); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_pre_decrement_v = sprout::has_pre_decrement::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_PRE_DECREMENT_HPP diff --git a/sprout/type_traits/has_pre_increment.hpp b/sprout/type_traits/has_pre_increment.hpp new file mode 100644 index 00000000..032776bf --- /dev/null +++ b/sprout/type_traits/has_pre_increment.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_PRE_INCREMENT_HPP +#define SPROUT_TYPE_TRAITS_HAS_PRE_INCREMENT_HPP + +#include +#include +#include + +namespace sprout { + // + // has_pre_increment + // + SPROUT_DETAIL_HAS_PRE_UNARY_OP_DECL(pre_increment, --); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_pre_increment_v = sprout::has_pre_increment::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_PRE_INCREMENT_HPP diff --git a/sprout/type_traits/has_right_shift.hpp b/sprout/type_traits/has_right_shift.hpp new file mode 100644 index 00000000..972ee49a --- /dev/null +++ b/sprout/type_traits/has_right_shift.hpp @@ -0,0 +1,30 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_RIGHT_SHIFT_HPP +#define SPROUT_TYPE_TRAITS_HAS_RIGHT_SHIFT_HPP + +#include +#include +#include + +namespace sprout { + // + // has_right_shift + // + template + struct has_right_shift + : public sprout::has_shift_right + {}; + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_right_shift_v = sprout::has_right_shift::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_RIGHT_SHIFT_HPP diff --git a/sprout/type_traits/has_right_shift_assign.hpp b/sprout/type_traits/has_right_shift_assign.hpp new file mode 100644 index 00000000..356db884 --- /dev/null +++ b/sprout/type_traits/has_right_shift_assign.hpp @@ -0,0 +1,30 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_SHIFT_RIGHT_ASSIGN_HPP +#define SPROUT_TYPE_TRAITS_HAS_SHIFT_RIGHT_ASSIGN_HPP + +#include +#include +#include + +namespace sprout { + // + // has_right_shift_assign + // + template::type, typename R = sprout::dont_care> + struct has_right_shift_assign + : public sprout::has_shift_right + {}; + +#if SPROUT_USE_VARIABLE_TEMPLATES + template::type, typename R = sprout::dont_care> + SPROUT_STATIC_CONSTEXPR bool has_right_shift_assign_v = sprout::has_right_shift_assign::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_SHIFT_RIGHT_ASSIGN_HPP diff --git a/sprout/type_traits/has_shift_left.hpp b/sprout/type_traits/has_shift_left.hpp new file mode 100644 index 00000000..70453e78 --- /dev/null +++ b/sprout/type_traits/has_shift_left.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_SHIFT_LEFT_HPP +#define SPROUT_TYPE_TRAITS_HAS_SHIFT_LEFT_HPP + +#include +#include +#include + +namespace sprout { + // + // has_shift_left + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(shift_left, <<, = T); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_shift_left_v = sprout::has_shift_left::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_SHIFT_LEFT_HPP diff --git a/sprout/type_traits/has_shift_left_assign.hpp b/sprout/type_traits/has_shift_left_assign.hpp new file mode 100644 index 00000000..7afba4cd --- /dev/null +++ b/sprout/type_traits/has_shift_left_assign.hpp @@ -0,0 +1,28 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_SHIFT_LEFT_HAS_ASSIGN_HPP +#define SPROUT_TYPE_TRAITS_SHIFT_LEFT_HAS_ASSIGN_HPP + +#include +#include +#include +#include + +namespace sprout { + // + // has_shift_left_assign + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(shift_left_assign, <<=, = typename sprout::const_reference::type); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template::type, typename R = sprout::dont_care> + SPROUT_STATIC_CONSTEXPR bool has_shift_left_assign_v = sprout::has_shift_left_assign::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_SHIFT_LEFT_HAS_ASSIGN_HPP diff --git a/sprout/type_traits/has_shift_right.hpp b/sprout/type_traits/has_shift_right.hpp new file mode 100644 index 00000000..e6d2d043 --- /dev/null +++ b/sprout/type_traits/has_shift_right.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_SHIFT_RIGHT_HPP +#define SPROUT_TYPE_TRAITS_HAS_SHIFT_RIGHT_HPP + +#include +#include +#include + +namespace sprout { + // + // has_shift_right + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(shift_right, >>, = T); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_shift_right_v = sprout::has_shift_right::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_SHIFT_RIGHT_HPP diff --git a/sprout/type_traits/has_shift_right_assign.hpp b/sprout/type_traits/has_shift_right_assign.hpp new file mode 100644 index 00000000..c1501874 --- /dev/null +++ b/sprout/type_traits/has_shift_right_assign.hpp @@ -0,0 +1,28 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_SHIFT_RIGHT_ASSIGN_HPP +#define SPROUT_TYPE_TRAITS_HAS_SHIFT_RIGHT_ASSIGN_HPP + +#include +#include +#include +#include + +namespace sprout { + // + // has_shift_right_assign + // + SPROUT_DETAIL_HAS_BINARY_OP_DECL(shift_right_assign, >>=, = typename sprout::const_reference::type); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template::type, typename R = sprout::dont_care> + SPROUT_STATIC_CONSTEXPR bool has_shift_right_assign_v = sprout::has_shift_right_assign::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_SHIFT_RIGHT_ASSIGN_HPP diff --git a/sprout/type_traits/has_subscript.hpp b/sprout/type_traits/has_subscript.hpp new file mode 100644 index 00000000..8f7504b3 --- /dev/null +++ b/sprout/type_traits/has_subscript.hpp @@ -0,0 +1,28 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_SUBSCRIPT_HPP +#define SPROUT_TYPE_TRAITS_HAS_SUBSCRIPT_HPP + +#include +#include +#include +#include + +namespace sprout { + // + // has_subscript + // + SPROUT_DETAIL_HAS_SUBSCRIPT_OP_DECL(subscript, [], = std::size_t); + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_subscript_v = sprout::has_subscript::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_SUBSCRIPT_HPP diff --git a/sprout/type_traits/has_unary_minus.hpp b/sprout/type_traits/has_unary_minus.hpp new file mode 100644 index 00000000..5125491f --- /dev/null +++ b/sprout/type_traits/has_unary_minus.hpp @@ -0,0 +1,30 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_UNARY_MINUS_HPP +#define SPROUT_TYPE_TRAITS_HAS_UNARY_MINUS_HPP + +#include +#include +#include + +namespace sprout { + // + // has_unary_minus + // + template + struct has_unary_minus + : public sprout::has_negate + {}; + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_unary_minus_v = sprout::has_unary_minus::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_UNARY_MINUS_HPP diff --git a/sprout/type_traits/has_unary_plus.hpp b/sprout/type_traits/has_unary_plus.hpp new file mode 100644 index 00000000..1274b95a --- /dev/null +++ b/sprout/type_traits/has_unary_plus.hpp @@ -0,0 +1,30 @@ +/*============================================================================= + Copyright (c) 2011-2016 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_TYPE_TRAITS_HAS_UNARY_PLUS_HPP +#define SPROUT_TYPE_TRAITS_HAS_UNARY_PLUS_HPP + +#include +#include +#include + +namespace sprout { + // + // has_unary_plus + // + template + struct has_unary_plus + : public sprout::has_posite + {}; + +#if SPROUT_USE_VARIABLE_TEMPLATES + template + SPROUT_STATIC_CONSTEXPR bool has_unary_plus_v = sprout::has_unary_plus::value; +#endif // #if SPROUT_USE_VARIABLE_TEMPLATES +} // namespace sprout + +#endif // #ifndef SPROUT_TYPE_TRAITS_HAS_UNARY_PLUS_HPP