mirror of
https://github.com/boostorg/callable_traits.git
synced 2026-02-02 20:52:13 +00:00
58 lines
1.4 KiB
C++
58 lines
1.4 KiB
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);
|
|
|
|
int main() {
|
|
|
|
{
|
|
using f = int(int);
|
|
using test = ct::apply_member_pointer<f, foo>;
|
|
using expect = int(foo::*)(int);
|
|
static_assert(std::is_same<test, expect>::value, "");
|
|
}
|
|
|
|
{
|
|
using f = int(* const &)(int);
|
|
using test = ct::apply_member_pointer<f, foo>;
|
|
using expect = int(foo::* const &)(int);
|
|
static_assert(std::is_same<test, expect>::value, "");
|
|
}
|
|
|
|
{
|
|
using f = int(&)(int);
|
|
using test = ct::apply_member_pointer<f, foo>;
|
|
using expect = int(foo::*)(int);
|
|
static_assert(std::is_same<test, expect>::value, "");
|
|
}
|
|
|
|
{
|
|
using f = int(foo::*)(int);
|
|
using test = ct::apply_member_pointer<f, foo>;
|
|
using expect = int(foo::*)(int);
|
|
static_assert(std::is_same<test, expect>::value, "");
|
|
}
|
|
|
|
{
|
|
using f = int(bar::* const)(int);
|
|
using test = ct::apply_member_pointer<f, foo>;
|
|
using expect = int(foo::* const)(int);
|
|
static_assert(std::is_same<test, expect>::value, "");
|
|
}
|
|
}
|
|
//]
|
|
|