diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/libs/callable_traits/test/args.cpp | |
parent | Initial commit. (diff) | |
download | ceph-upstream.tar.xz ceph-upstream.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/callable_traits/test/args.cpp')
-rw-r--r-- | src/boost/libs/callable_traits/test/args.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/boost/libs/callable_traits/test/args.cpp b/src/boost/libs/callable_traits/test/args.cpp new file mode 100644 index 00000000..b3f5138a --- /dev/null +++ b/src/boost/libs/callable_traits/test/args.cpp @@ -0,0 +1,67 @@ +/* + +Copyright Barrett Adair 2015-2017 +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 <type_traits> +#include <cstdint> +#include <memory> +#include <boost/callable_traits.hpp> +#include "test.hpp" + + +struct foo1 { + int bar(char, float&, int = 0) { return{}; } +}; + +struct foo2 { + int bar(char, float&, int = 0, ...) { return{}; } +}; + +struct foo3 { + int operator()(char, float&, int = 0) { return{}; } +}; + +struct foo4 { + int operator()(char, float&, int = 0, ...) { return{}; } +}; + +int foo5(char, float&, int = 0) { return{}; } + +int foo6(char, float&, int = 0, ...) { return{}; } + +struct foo7 { + int bar() { return{}; } +}; + +using std::is_same; + +int main() { + + { + using pmf = decltype(&foo1::bar); + using args_t = TRAIT(args, pmf); + CT_ASSERT(is_same<args_t, std::tuple<foo1&, char, float&, int>>{}); + } { + using pmf = decltype(&foo2::bar); + using args_t = TRAIT(args, pmf); + CT_ASSERT(is_same<args_t, std::tuple<foo2&, char, float&, int>>{}); + } { + using args_t = TRAIT(args, foo3); + CT_ASSERT(is_same<args_t, std::tuple<char, float&, int>>{}); + } { + using args_t = TRAIT(args, foo4); + CT_ASSERT(is_same<args_t, std::tuple<char, float&, int>>{}); + } { + using args_t = TRAIT(args, decltype(foo5)); + CT_ASSERT(is_same<args_t, std::tuple<char, float&, int>>{}); + } { + using args_t = TRAIT(args, decltype(foo6)); + CT_ASSERT(is_same<args_t, std::tuple<char, float&, int>>{}); + } + + return 0; +} |