File: test_function_traits.cpp

package info (click to toggle)
gridtools 2.3.8-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 21,264 kB
  • sloc: cpp: 107,228; python: 17,464; javascript: 9,164; ansic: 4,227; sh: 850; f90: 393; makefile: 230
file content (16 lines) | stat: -rw-r--r-- 1,044 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <cpp_bindgen/common/function_traits.hpp>

namespace ft = cpp_bindgen::function_traits;
static_assert(std::is_same<typename ft::result_type<void(int)>::type, void>::value, "");
static_assert(std::is_same<typename ft::result_type<void(int, double)>::type, void>::value, "");
static_assert(std::is_same<typename ft::result_type<int(int, double)>::type, int>::value, "");

static_assert(std::is_same<typename ft::parameter_types<void()>::type, std::tuple<>>::value, "");
static_assert(std::is_same<typename ft::parameter_types<void(int)>::type, std::tuple<int>>::value, "");
static_assert(std::is_same<typename ft::parameter_types<void(int, double)>::type, std::tuple<int, double>>::value, "");
static_assert(std::is_same<typename ft::parameter_types<int(int, double)>::type, std::tuple<int, double>>::value, "");

static_assert(ft::arity<void()>::value == 0, "");
static_assert(ft::arity<void(int)>::value == 1, "");
static_assert(ft::arity<void(int, double)>::value == 2, "");
static_assert(ft::arity<int(int, double)>::value == 2, "");