kblib 0.2.3
General utilities library for modern C++
traits.cpp
Go to the documentation of this file.
1#include "kblib/traits.h"
2#include <catch.hpp>
3
4struct k {
5 char c[10];
6};
7
8static_assert(not std::is_reference<kblib::member_of_t<decltype(&k::c)>>::value,
9 "");
10static_assert(kblib::is_iterable<int[10]>::value, "");
11
12static void f(int i, std::string s) {}
13
14TEST_CASE("type_constant") {
15 auto fw = kblib::type_constant<decltype(f)*, f>{};
16 int i{};
17 std::string s;
18 f(i, s);
19 fw(i, s);
20}
typename member_of< T >::type member_of_t
Definition: traits.h:297
Definition: traits.cpp:4
char c[10]
Definition: traits.cpp:5
TEST_CASE("type_constant")
Definition: traits.cpp:14
Contains some type traits not in the standard library that are useful in the implementation of kblib.