mirror of
https://github.com/boostorg/callable_traits.git
synced 2026-02-12 12:02:24 +00:00
adding member pointer manipulations to interface
This commit is contained in:
32
example/apply_member_pointer/example.cpp
Normal file
32
example/apply_member_pointer/example.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
/*!
|
||||
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)
|
||||
*/
|
||||
|
||||
#include <callable_traits/callable_traits.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)>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user