Skip to content
Snippets Groups Projects
Commit fd417732 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

functors with arbitrary nr of arguments

parent 083a5c96
No related branches found
No related tags found
1 merge request!1Issue/functor expression args
......@@ -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;
......
......@@ -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_ > {};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment