Files
callable_traits/example/apply_member_pointer.cpp
2016-04-07 21:00:51 -05:00

36 lines
721 B
C++

/*<-
Copyright (c) 2016 Barrett Adair
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
->*/
//[ apply_member_pointer
#include <type_traits>
#include <callable_traits/apply_member_pointer.hpp>
namespace ct = callable_traits;
struct foo;
struct bar;
using expect = int(foo::*)(int);
template<typename T>
void test() {
using U = ct::apply_member_pointer<T, foo>;
static_assert(std::is_same<expect, U>{}, "");
}
int main() {
test<int(int)>();
test<int(*)(int)>();
test<int(*&)(int)>();
test<int(* const)(int)>();
test<int(&)(int)>();
test<int(foo::*)(int)>();
test<int(bar::*)(int)>();
}
//]