GraphLab: Distributed Graph-Parallel API  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
graphlab::test_function_or_functor_2< F, PreferredFunctionForm, RetType, Arg1, Arg2 > Struct Template Reference

This tests that a type F matches a specification for a function type or implements a specification for a functor type. More...

#include <graphlab/util/generics/test_function_or_functor_type.hpp>

List of all members.

Static Public Member Functions

template<typename T >
static char test1 (SFINAE1< T,&T::operator()>*)
template<typename T >
static int test1 (...)

Static Public Attributes

static const bool value

Detailed Description

template<typename F, typename PreferredFunctionForm, typename RetType, typename Arg1, typename Arg2>
struct graphlab::test_function_or_functor_2< F, PreferredFunctionForm, RetType, Arg1, Arg2 >

This tests that a type F matches a specification for a function type or implements a specification for a functor type.

Where F is the type to test:

test_function_or_functor_1<F, PreferredFunctionForm, RetType, Arg1>::value
is true if any of the following is true:

  • F is the same type as PreferredFunctionForm
  • F is the same type as PreferredFunctionForm*
  • F implements an F::operator() with the prototype RetType F::operator()(Arg1)

For instance,

test_function_or_functor_1<F, void(const int&), void, const int&>::value
is true if any of the following is true:

  • F is a void(const int&)
  • F is a void(*)(const int&)
  • F is a class which implements void F::operator()(const int&)

There is an additional "const" variant test_function_or_const_functor_1 which requires operator() to be a const function. i.e.:

test_function_or_const_functor_1<F, void(const int&), void, const int&>::value
is true if any of the following is true:

  • F is the same type as PreferredFunctionForm
  • F is the same type as PreferredFunctionForm*
  • F implements an F::operator() with the prototype RetType F::operator()(Arg1) const

Both variants have a 2 argument version test_function_or_functor_2 and test_function_or_const_functor_2 which take an additional template argument for the second argument.

Definition at line 126 of file test_function_or_functor_type.hpp.


Member Data Documentation

template<typename F , typename PreferredFunctionForm , typename RetType , typename Arg1 , typename Arg2 >
const bool graphlab::test_function_or_functor_2< F, PreferredFunctionForm, RetType, Arg1, Arg2 >::value
static
Initial value:
((sizeof(test1<F>(0)) == sizeof(char)) ||
boost::is_same<F, PreferredFunctionForm>::value ||
boost::is_same<typename boost::remove_pointer<F>::type, PreferredFunctionForm>::value)

Definition at line 138 of file test_function_or_functor_type.hpp.


The documentation for this struct was generated from the following file: