File: test_function_traits.cpp

package info (click to toggle)
gridtools 2.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 21,728 kB
  • sloc: cpp: 45,263; python: 9,383; javascript: 8,445; ansic: 2,564; sh: 509; f90: 370; makefile: 216
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, "");