diff --git a/AMDiS/src/expressions/expr_traits.hpp b/AMDiS/src/expressions/expr_traits.hpp index 15c9bc1b2ad374db2a5145cef5ea0e208cc162a8..1486c0603bebd456eceaffb0601102b07ba1e4d9 100644 --- a/AMDiS/src/expressions/expr_traits.hpp +++ b/AMDiS/src/expressions/expr_traits.hpp @@ -41,10 +41,10 @@ namespace AMDiS struct is_constant : is_numeric<T>::type {}; template<typename T> - struct is_constant<WorldVector<T> > : boost::mpl::bool_<true> {}; + struct is_constant<WorldVector<T> > : bool_<true> {}; template<typename T> - struct is_constant<WorldMatrix<T> > : boost::mpl::bool_<true> {}; + struct is_constant<WorldMatrix<T> > : bool_<true> {}; // type-traits for terms @@ -56,18 +56,18 @@ namespace AMDiS // type-traits for arguments, filter terms and constants // ___________________________________________________________________________ template<typename T> - struct is_valid_arg : boost::mpl::or_ + struct is_valid_arg : or_ < typename is_expr<T>::type, typename is_constant<T>::type >::type {}; template<typename T1, typename T2> - struct is_valid_arg2 : boost::mpl::and_ + struct is_valid_arg2 : and_ < typename is_valid_arg<T1>::type, typename is_valid_arg<T2>::type, - typename boost::mpl::or_ + typename or_ < typename is_expr<T1>::type, typename is_expr<T2>::type @@ -75,12 +75,12 @@ namespace AMDiS >::type {}; template<typename T1, typename T2, typename T3> - struct is_valid_arg3 : boost::mpl::and_ + struct is_valid_arg3 : and_ < typename is_valid_arg<T1>::type, typename is_valid_arg<T2>::type, typename is_valid_arg<T3>::type, - typename boost::mpl::or_ + typename or_ < typename is_expr<T1>::type, typename is_expr<T2>::type, @@ -92,7 +92,7 @@ namespace AMDiS // expressions template < typename T > - struct category<T, typename boost::enable_if< typename is_expr<T>::type >::type > + struct category<T, typename enable_if< typename is_expr<T>::type >::type > { typedef tag::expression tag; typedef typename T::value_type value_type; diff --git a/AMDiS/src/traits/basic.hpp b/AMDiS/src/traits/basic.hpp index 462d55983813c4f00fa75660190e3cadea1aae85..f6e54f51bb537af3a4a4c8a6d5b0914ae201a275 100644 --- a/AMDiS/src/traits/basic.hpp +++ b/AMDiS/src/traits/basic.hpp @@ -35,7 +35,7 @@ #include <boost/utility/enable_if.hpp> #endif -#ifdef HAS_CPP11 +#ifdef HAS_CXX11 #include <type_traits> #endif @@ -44,11 +44,52 @@ namespace AMDiS // introduce some shortcuts for boost::mpl // --------------------------------------- + +#ifdef HAS_CXX11 + template <bool B> + using bool_ = std::integral_constant<bool, B>; + + using true_ = bool_<true>; + using false_ = bool_<false>; + + namespace aux + { + template <class... Ts> struct or_; + + template <class T0, class... Ts> + struct or_<T0, Ts...> : bool_<T0::value || or_<Ts...>::value> {}; + + template <> + struct or_<> : false_ {}; + + template <class... Ts> struct and_; + + template <class T0, class... Ts> + struct and_<T0, Ts...> : bool_<T0::value && and_<Ts...>::value> {}; + + template <> + struct and_<> : true_ {}; + + } // end namespace aux + + + template <class... Ts> + using and_ = aux::and_<Ts...>; + + template <class... Ts> + using or_ = aux::or_<Ts...>; + + template <class A> + using not_ = bool_<!(A::value)>; + +#else using boost::mpl::bool_; using boost::mpl::true_; using boost::mpl::false_; using boost::mpl::and_; using boost::mpl::or_; + using boost::mpl::not_; +#endif using boost::enable_if; using boost::enable_if_c; @@ -74,13 +115,8 @@ namespace AMDiS boost::is_same< typename mtl::Addable<A,B>::result_type, no_valid_type > > {}; -#ifdef HAS_CPP11 - template <typename T> - struct is_trivially_copyable : std::is_trivially_copyable<T> {}; -#else template <typename T> struct is_trivially_copyable : boost::is_pod<T> {}; -#endif template <class T, T A, T B> struct equal : boost::mpl::if_c< A == B, true_, false_ > {};