-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathFuncTraitsTest.cpp
More file actions
45 lines (40 loc) · 1.5 KB
/
FuncTraitsTest.cpp
File metadata and controls
45 lines (40 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* Copyright (c) 2018 HERE Europe B.V.
* See the LICENSE file in the root of this project for license details.
*/
#include <flatdata/internal/functional/FuncTraits.h>
namespace flatdata
{
namespace functraits_test
{
void
free_function( std::true_type )
{
}
void
zero_arity_function( )
{
}
struct Functor
{
void
operator( )( std::true_type, std::true_type )
{
}
};
static_assert( is_callable_with< decltype( free_function ), std::true_type >::value,
"Free function is callable with its arguments" );
static_assert( !is_callable_with< decltype( free_function ), std::false_type >::value,
"Free function is not callable with non-implicitly "
"convertible arguments" );
static_assert( is_callable_with< decltype( zero_arity_function ) >::value,
"Free function with zero arity is callable without arguments" );
static_assert( !is_callable_with< decltype( zero_arity_function ), std::true_type >::value,
"Free function with zero arity is not callable with wrong arity" );
static_assert( is_callable_with< Functor, std::true_type, std::true_type >::value,
"Functor is callable with its arguments" );
static_assert( !is_callable_with< Functor, std::true_type, std::false_type >::value,
"Functor is not callable with non-implicitly convertible arguments" );
static_assert( !is_callable_with< Functor >::value, "Functor is not callable with wrong arity" );
} // namespace functraits_test
} // namespace flatdata