mirror of
https://github.com/boostorg/callable_traits.git
synced 2026-07-21 13:03:28 +00:00
Fixed newlines, tabs and ensured the source files end with a newline.
This commit is contained in:
@@ -18,10 +18,10 @@ int main(){}
|
||||
using boost::callable_traits::add_noexcept_t;
|
||||
|
||||
static_assert(std::is_same<
|
||||
add_noexcept_t<int()>,
|
||||
int() noexcept
|
||||
add_noexcept_t<int()>,
|
||||
int() noexcept
|
||||
>{}, "");
|
||||
|
||||
|
||||
int main() {}
|
||||
|
||||
//]
|
||||
|
||||
@@ -18,10 +18,10 @@ int main(){}
|
||||
using boost::callable_traits::remove_noexcept_t;
|
||||
|
||||
static_assert(std::is_same<
|
||||
remove_noexcept_t<int() noexcept>,
|
||||
int()
|
||||
remove_noexcept_t<int() noexcept>,
|
||||
int()
|
||||
>{}, "");
|
||||
|
||||
|
||||
int main() {}
|
||||
|
||||
//]
|
||||
|
||||
@@ -1,51 +1,51 @@
|
||||
#ifndef BOOST_CLBL_TRTS_PARAMETER_INDEX_HELPER_HPP
|
||||
#define BOOST_CLBL_TRTS_PARAMETER_INDEX_HELPER_HPP
|
||||
|
||||
#include <boost/callable_traits/detail/config.hpp>
|
||||
|
||||
namespace boost { namespace callable_traits { namespace detail {
|
||||
|
||||
template<std::size_t I, typename T, bool IgnoreThisPointer = false,
|
||||
bool AllowPlus1 = false, std::size_t Count = 0>
|
||||
struct parameter_index_helper {
|
||||
|
||||
using error_t = error_type<T>;
|
||||
|
||||
using args_tuple = typename std::conditional<IgnoreThisPointer,
|
||||
typename detail::traits<T>::non_invoke_arg_types,
|
||||
typename detail::traits<T>::arg_types>::type;
|
||||
|
||||
static constexpr bool has_parameter_list =
|
||||
!std::is_same<args_tuple, invalid_type>::value
|
||||
&& !std::is_same<args_tuple, reference_error>::value;
|
||||
|
||||
using temp_tuple = typename std::conditional<has_parameter_list,
|
||||
args_tuple, std::tuple<error_t>>::type;
|
||||
|
||||
static constexpr std::size_t parameter_list_size =
|
||||
std::tuple_size<temp_tuple>::value;
|
||||
|
||||
static constexpr bool is_out_of_range = has_parameter_list &&
|
||||
I >= parameter_list_size + static_cast<std::size_t>(AllowPlus1);
|
||||
|
||||
static constexpr bool is_count_out_of_range = has_parameter_list &&
|
||||
I + Count > parameter_list_size + static_cast<std::size_t>(AllowPlus1);
|
||||
|
||||
static constexpr std::size_t index =
|
||||
has_parameter_list && !is_out_of_range ? I : 0;
|
||||
|
||||
static constexpr std::size_t count =
|
||||
has_parameter_list && !is_count_out_of_range ? Count : 0;
|
||||
|
||||
using permissive_tuple = typename std::conditional<
|
||||
has_parameter_list && !is_out_of_range,
|
||||
args_tuple, std::tuple<error_t>>::type;
|
||||
|
||||
using permissive_function = typename std::conditional<
|
||||
has_parameter_list && !is_out_of_range,
|
||||
T, error_t(error_t)>::type;
|
||||
};
|
||||
|
||||
}}} // namespace boost::callable_traits::detail
|
||||
|
||||
#endif // #ifndef BOOST_CLBL_TRTS_PARAMETER_INDEX_HELPER_HPP
|
||||
#ifndef BOOST_CLBL_TRTS_PARAMETER_INDEX_HELPER_HPP
|
||||
#define BOOST_CLBL_TRTS_PARAMETER_INDEX_HELPER_HPP
|
||||
|
||||
#include <boost/callable_traits/detail/config.hpp>
|
||||
|
||||
namespace boost { namespace callable_traits { namespace detail {
|
||||
|
||||
template<std::size_t I, typename T, bool IgnoreThisPointer = false,
|
||||
bool AllowPlus1 = false, std::size_t Count = 0>
|
||||
struct parameter_index_helper {
|
||||
|
||||
using error_t = error_type<T>;
|
||||
|
||||
using args_tuple = typename std::conditional<IgnoreThisPointer,
|
||||
typename detail::traits<T>::non_invoke_arg_types,
|
||||
typename detail::traits<T>::arg_types>::type;
|
||||
|
||||
static constexpr bool has_parameter_list =
|
||||
!std::is_same<args_tuple, invalid_type>::value
|
||||
&& !std::is_same<args_tuple, reference_error>::value;
|
||||
|
||||
using temp_tuple = typename std::conditional<has_parameter_list,
|
||||
args_tuple, std::tuple<error_t>>::type;
|
||||
|
||||
static constexpr std::size_t parameter_list_size =
|
||||
std::tuple_size<temp_tuple>::value;
|
||||
|
||||
static constexpr bool is_out_of_range = has_parameter_list &&
|
||||
I >= parameter_list_size + static_cast<std::size_t>(AllowPlus1);
|
||||
|
||||
static constexpr bool is_count_out_of_range = has_parameter_list &&
|
||||
I + Count > parameter_list_size + static_cast<std::size_t>(AllowPlus1);
|
||||
|
||||
static constexpr std::size_t index =
|
||||
has_parameter_list && !is_out_of_range ? I : 0;
|
||||
|
||||
static constexpr std::size_t count =
|
||||
has_parameter_list && !is_count_out_of_range ? Count : 0;
|
||||
|
||||
using permissive_tuple = typename std::conditional<
|
||||
has_parameter_list && !is_out_of_range,
|
||||
args_tuple, std::tuple<error_t>>::type;
|
||||
|
||||
using permissive_function = typename std::conditional<
|
||||
has_parameter_list && !is_out_of_range,
|
||||
T, error_t(error_t)>::type;
|
||||
};
|
||||
|
||||
}}} // namespace boost::callable_traits::detail
|
||||
|
||||
#endif // #ifndef BOOST_CLBL_TRTS_PARAMETER_INDEX_HELPER_HPP
|
||||
|
||||
+2
-2
@@ -8,11 +8,11 @@
|
||||
Automatic redirection failed, click this <a href="doc/html/index.html">link</a>
|
||||
<hr>
|
||||
<p>Copyright Louis Dionne, 2013-2016</p>
|
||||
<p>Copyright Modified Work Barrett Adair, 2013-2016</p>
|
||||
<p>Copyright Modified Work Barrett Adair, 2013-2016</p>
|
||||
<p>
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file <a href="LICENSE.md">LICENSE.md</a> or copy at
|
||||
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -1,51 +1,51 @@
|
||||
/*
|
||||
Copyright Barrett Adair 2016-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 <boost/callable_traits/add_transaction_safe.hpp>
|
||||
#include <tuple>
|
||||
#include "test.hpp"
|
||||
|
||||
#ifndef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE
|
||||
int main(){}
|
||||
#else
|
||||
|
||||
struct foo;
|
||||
|
||||
template<typename T>
|
||||
struct is_substitution_failure_add_tx_safe {
|
||||
|
||||
template<typename>
|
||||
static auto test(...) -> std::true_type;
|
||||
|
||||
template<typename A,
|
||||
typename std::remove_reference<
|
||||
TRAIT(add_transaction_safe, A)>::type* = nullptr>
|
||||
static auto test(int) -> std::false_type;
|
||||
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
int main() {
|
||||
|
||||
auto lambda = [](){};
|
||||
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<decltype(lambda)>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<decltype(lambda)&>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<int>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<int &>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<int (* const &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<int (foo::* &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<int (foo::* const)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<int (foo::* const &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<int (foo::* volatile)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<void>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<void*>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<void(**)()>::value);
|
||||
}
|
||||
|
||||
#endif //#ifndef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE
|
||||
/*
|
||||
Copyright Barrett Adair 2016-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 <boost/callable_traits/add_transaction_safe.hpp>
|
||||
#include <tuple>
|
||||
#include "test.hpp"
|
||||
|
||||
#ifndef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE
|
||||
int main(){}
|
||||
#else
|
||||
|
||||
struct foo;
|
||||
|
||||
template<typename T>
|
||||
struct is_substitution_failure_add_tx_safe {
|
||||
|
||||
template<typename>
|
||||
static auto test(...) -> std::true_type;
|
||||
|
||||
template<typename A,
|
||||
typename std::remove_reference<
|
||||
TRAIT(add_transaction_safe, A)>::type* = nullptr>
|
||||
static auto test(int) -> std::false_type;
|
||||
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
int main() {
|
||||
|
||||
auto lambda = [](){};
|
||||
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<decltype(lambda)>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<decltype(lambda)&>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<int>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<int &>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<int (* const &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<int (foo::* &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<int (foo::* const)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<int (foo::* const &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<int (foo::* volatile)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<void>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<void*>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_tx_safe<void(**)()>::value);
|
||||
}
|
||||
|
||||
#endif //#ifndef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
/*
|
||||
Copyright Barrett Adair 2016-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 <boost/callable_traits/add_varargs.hpp>
|
||||
#include <tuple>
|
||||
#include "test.hpp"
|
||||
|
||||
struct foo;
|
||||
|
||||
template<typename T>
|
||||
struct is_substitution_failure_add_varargs {
|
||||
|
||||
template<typename>
|
||||
static auto test(...) -> std::true_type;
|
||||
|
||||
template<typename A,
|
||||
typename std::remove_reference<
|
||||
TRAIT(add_varargs, A)>::type* = nullptr>
|
||||
static auto test(int) -> std::false_type;
|
||||
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
int main() {
|
||||
|
||||
auto lambda = [](){};
|
||||
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<decltype(lambda)>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<decltype(lambda)&>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<int>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<int &>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<int (* const &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<int (foo::* &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<int (foo::* const)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<int (foo::* const &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<int (foo::* volatile)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<void>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<void*>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<void(**)()>::value);
|
||||
}
|
||||
/*
|
||||
Copyright Barrett Adair 2016-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 <boost/callable_traits/add_varargs.hpp>
|
||||
#include <tuple>
|
||||
#include "test.hpp"
|
||||
|
||||
struct foo;
|
||||
|
||||
template<typename T>
|
||||
struct is_substitution_failure_add_varargs {
|
||||
|
||||
template<typename>
|
||||
static auto test(...) -> std::true_type;
|
||||
|
||||
template<typename A,
|
||||
typename std::remove_reference<
|
||||
TRAIT(add_varargs, A)>::type* = nullptr>
|
||||
static auto test(int) -> std::false_type;
|
||||
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
int main() {
|
||||
|
||||
auto lambda = [](){};
|
||||
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<decltype(lambda)>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<decltype(lambda)&>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<int>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<int &>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<int (* const &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<int (foo::* &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<int (foo::* const)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<int (foo::* const &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<int (foo::* volatile)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<void>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<void*>::value);
|
||||
CT_ASSERT(is_substitution_failure_add_varargs<void(**)()>::value);
|
||||
}
|
||||
|
||||
+52
-52
@@ -1,52 +1,52 @@
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
#include <boost/callable_traits/class_of.hpp>
|
||||
#include "test.hpp"
|
||||
|
||||
struct foo;
|
||||
|
||||
int main() {
|
||||
|
||||
{
|
||||
using f = void(foo::*)();
|
||||
using test = TRAIT(class_of, f);
|
||||
using expect = foo;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
|
||||
{
|
||||
using f = void(foo::*)() const;
|
||||
using test = TRAIT(class_of, f);
|
||||
using expect = foo;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
|
||||
{
|
||||
using f = void(foo::*)() volatile;
|
||||
using test = TRAIT(class_of, f);
|
||||
using expect = foo;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
|
||||
{
|
||||
using f = void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(int, ...) const volatile;
|
||||
using test = TRAIT(class_of, f);
|
||||
using expect = foo;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
|
||||
{
|
||||
using f = int foo::*;
|
||||
using test = TRAIT(class_of, f);
|
||||
using expect = foo;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
|
||||
{
|
||||
using f = const int foo::*;
|
||||
using test = TRAIT(class_of, f);
|
||||
using expect = foo;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
}
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
#include <boost/callable_traits/class_of.hpp>
|
||||
#include "test.hpp"
|
||||
|
||||
struct foo;
|
||||
|
||||
int main() {
|
||||
|
||||
{
|
||||
using f = void(foo::*)();
|
||||
using test = TRAIT(class_of, f);
|
||||
using expect = foo;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
|
||||
{
|
||||
using f = void(foo::*)() const;
|
||||
using test = TRAIT(class_of, f);
|
||||
using expect = foo;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
|
||||
{
|
||||
using f = void(foo::*)() volatile;
|
||||
using test = TRAIT(class_of, f);
|
||||
using expect = foo;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
|
||||
{
|
||||
using f = void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(int, ...) const volatile;
|
||||
using test = TRAIT(class_of, f);
|
||||
using expect = foo;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
|
||||
{
|
||||
using f = int foo::*;
|
||||
using test = TRAIT(class_of, f);
|
||||
using expect = foo;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
|
||||
{
|
||||
using f = const int foo::*;
|
||||
using test = TRAIT(class_of, f);
|
||||
using expect = foo;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
|
||||
/*
|
||||
Copyright Barrett Adair 2016-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 <boost/callable_traits/class_of.hpp>
|
||||
#include "test.hpp"
|
||||
|
||||
struct foo;
|
||||
|
||||
template<typename T>
|
||||
struct is_substitution_failure_class_of {
|
||||
|
||||
template<typename>
|
||||
static auto test(...) -> std::true_type;
|
||||
|
||||
template<typename A,
|
||||
typename std::remove_reference<
|
||||
TRAIT(class_of, A)>::type* = nullptr>
|
||||
static auto test(int) -> std::false_type;
|
||||
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
int main() {
|
||||
|
||||
auto lambda = [](){};
|
||||
|
||||
CT_ASSERT(is_substitution_failure_class_of<decltype(lambda)>::value);
|
||||
CT_ASSERT(is_substitution_failure_class_of<decltype(lambda)&>::value);
|
||||
CT_ASSERT(is_substitution_failure_class_of<void>::value);
|
||||
CT_ASSERT(is_substitution_failure_class_of<void*>::value);
|
||||
CT_ASSERT(is_substitution_failure_class_of<int>::value);
|
||||
CT_ASSERT(is_substitution_failure_class_of<int &>::value);
|
||||
CT_ASSERT(is_substitution_failure_class_of<int()>::value);
|
||||
CT_ASSERT(is_substitution_failure_class_of<int(*)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_class_of<int(**)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_class_of<int(&)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_class_of<int (foo::** const)()>::value);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Copyright Barrett Adair 2016-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 <boost/callable_traits/class_of.hpp>
|
||||
#include "test.hpp"
|
||||
|
||||
struct foo;
|
||||
|
||||
template<typename T>
|
||||
struct is_substitution_failure_class_of {
|
||||
|
||||
template<typename>
|
||||
static auto test(...) -> std::true_type;
|
||||
|
||||
template<typename A,
|
||||
typename std::remove_reference<
|
||||
TRAIT(class_of, A)>::type* = nullptr>
|
||||
static auto test(int) -> std::false_type;
|
||||
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
int main() {
|
||||
|
||||
auto lambda = [](){};
|
||||
|
||||
CT_ASSERT(is_substitution_failure_class_of<decltype(lambda)>::value);
|
||||
CT_ASSERT(is_substitution_failure_class_of<decltype(lambda)&>::value);
|
||||
CT_ASSERT(is_substitution_failure_class_of<void>::value);
|
||||
CT_ASSERT(is_substitution_failure_class_of<void*>::value);
|
||||
CT_ASSERT(is_substitution_failure_class_of<int>::value);
|
||||
CT_ASSERT(is_substitution_failure_class_of<int &>::value);
|
||||
CT_ASSERT(is_substitution_failure_class_of<int()>::value);
|
||||
CT_ASSERT(is_substitution_failure_class_of<int(*)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_class_of<int(**)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_class_of<int(&)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_class_of<int (foo::** const)()>::value);
|
||||
}
|
||||
|
||||
|
||||
@@ -93,4 +93,4 @@ int main() {
|
||||
using F = void (foo const &, int, int, int, ...);
|
||||
CT_ASSERT(std::is_same<TRAIT(function_type, G), F>::value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+58
-58
@@ -1,58 +1,58 @@
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
#include <boost/callable_traits/has_void_return.hpp>
|
||||
#include "test.hpp"
|
||||
|
||||
struct foo;
|
||||
|
||||
template<typename T>
|
||||
void assert_void_return() {
|
||||
CT_ASSERT(has_void_return<T>::value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void assert_not_void_return() {
|
||||
CT_ASSERT(!has_void_return<T>::value);
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
assert_void_return<void()>();
|
||||
assert_void_return<void(...)>();
|
||||
|
||||
#ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
|
||||
assert_void_return<void(int) const>();
|
||||
assert_void_return<void(int) volatile>();
|
||||
assert_void_return<void(int) const volatile>();
|
||||
#endif // #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
|
||||
|
||||
assert_void_return<void(foo::*)()>();
|
||||
assert_void_return<void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(int, ...)>();
|
||||
assert_void_return<void(foo::*)(int) const>();
|
||||
assert_void_return<void(foo::*)() volatile>();
|
||||
assert_void_return<void(foo::*)(int) const volatile>();
|
||||
|
||||
assert_void_return<void(*)()>();
|
||||
assert_void_return<void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC *)(int, ...)>();
|
||||
|
||||
assert_void_return<void(&)(int)>();
|
||||
assert_void_return<void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC &)(...)>();
|
||||
|
||||
auto lambda = []{};
|
||||
assert_void_return<decltype(lambda)>();
|
||||
|
||||
assert_not_void_return<void>();
|
||||
assert_not_void_return<int>();
|
||||
assert_not_void_return<void*>();
|
||||
assert_not_void_return<void* foo::*>();
|
||||
assert_not_void_return<void(** const)()>();
|
||||
assert_not_void_return<int()>();
|
||||
assert_not_void_return<int(*)()>();
|
||||
assert_not_void_return<int(&)()>();
|
||||
assert_not_void_return<int(foo::*)()>();
|
||||
assert_not_void_return<int(foo::*)() const>();
|
||||
assert_not_void_return<int(foo::*)() volatile>();
|
||||
assert_not_void_return<int(foo::*)() const volatile>();
|
||||
assert_not_void_return<void(foo::**)()>();
|
||||
}
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
#include <boost/callable_traits/has_void_return.hpp>
|
||||
#include "test.hpp"
|
||||
|
||||
struct foo;
|
||||
|
||||
template<typename T>
|
||||
void assert_void_return() {
|
||||
CT_ASSERT(has_void_return<T>::value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void assert_not_void_return() {
|
||||
CT_ASSERT(!has_void_return<T>::value);
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
assert_void_return<void()>();
|
||||
assert_void_return<void(...)>();
|
||||
|
||||
#ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
|
||||
assert_void_return<void(int) const>();
|
||||
assert_void_return<void(int) volatile>();
|
||||
assert_void_return<void(int) const volatile>();
|
||||
#endif // #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
|
||||
|
||||
assert_void_return<void(foo::*)()>();
|
||||
assert_void_return<void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(int, ...)>();
|
||||
assert_void_return<void(foo::*)(int) const>();
|
||||
assert_void_return<void(foo::*)() volatile>();
|
||||
assert_void_return<void(foo::*)(int) const volatile>();
|
||||
|
||||
assert_void_return<void(*)()>();
|
||||
assert_void_return<void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC *)(int, ...)>();
|
||||
|
||||
assert_void_return<void(&)(int)>();
|
||||
assert_void_return<void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC &)(...)>();
|
||||
|
||||
auto lambda = []{};
|
||||
assert_void_return<decltype(lambda)>();
|
||||
|
||||
assert_not_void_return<void>();
|
||||
assert_not_void_return<int>();
|
||||
assert_not_void_return<void*>();
|
||||
assert_not_void_return<void* foo::*>();
|
||||
assert_not_void_return<void(** const)()>();
|
||||
assert_not_void_return<int()>();
|
||||
assert_not_void_return<int(*)()>();
|
||||
assert_not_void_return<int(&)()>();
|
||||
assert_not_void_return<int(foo::*)()>();
|
||||
assert_not_void_return<int(foo::*)() const>();
|
||||
assert_not_void_return<int(foo::*)() volatile>();
|
||||
assert_not_void_return<int(foo::*)() const volatile>();
|
||||
assert_not_void_return<void(foo::**)()>();
|
||||
}
|
||||
|
||||
+52
-52
@@ -1,52 +1,52 @@
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
#include <boost/callable_traits/qualified_class_of.hpp>
|
||||
#include "test.hpp"
|
||||
|
||||
struct foo;
|
||||
|
||||
int main() {
|
||||
|
||||
{
|
||||
using f = void(foo::*)();
|
||||
using test = TRAIT(qualified_class_of, f);
|
||||
using expect = foo &;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
|
||||
{
|
||||
using f = void(foo::*)() const;
|
||||
using test = TRAIT(qualified_class_of, f);
|
||||
using expect = foo const &;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
|
||||
{
|
||||
using f = void(foo::*)() volatile;
|
||||
using test = TRAIT(qualified_class_of, f);
|
||||
using expect = foo volatile &;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
|
||||
{
|
||||
using f = void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(int, ...) const volatile;
|
||||
using test = TRAIT(qualified_class_of, f);
|
||||
using expect = foo const volatile &;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
|
||||
{
|
||||
using f = int foo::*;
|
||||
using test = TRAIT(qualified_class_of, f);
|
||||
using expect = foo const &;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
|
||||
{
|
||||
using f = const int foo::*;
|
||||
using test = TRAIT(qualified_class_of, f);
|
||||
using expect = foo const &;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
}
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
#include <boost/callable_traits/qualified_class_of.hpp>
|
||||
#include "test.hpp"
|
||||
|
||||
struct foo;
|
||||
|
||||
int main() {
|
||||
|
||||
{
|
||||
using f = void(foo::*)();
|
||||
using test = TRAIT(qualified_class_of, f);
|
||||
using expect = foo &;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
|
||||
{
|
||||
using f = void(foo::*)() const;
|
||||
using test = TRAIT(qualified_class_of, f);
|
||||
using expect = foo const &;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
|
||||
{
|
||||
using f = void(foo::*)() volatile;
|
||||
using test = TRAIT(qualified_class_of, f);
|
||||
using expect = foo volatile &;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
|
||||
{
|
||||
using f = void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(int, ...) const volatile;
|
||||
using test = TRAIT(qualified_class_of, f);
|
||||
using expect = foo const volatile &;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
|
||||
{
|
||||
using f = int foo::*;
|
||||
using test = TRAIT(qualified_class_of, f);
|
||||
using expect = foo const &;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
|
||||
{
|
||||
using f = const int foo::*;
|
||||
using test = TRAIT(qualified_class_of, f);
|
||||
using expect = foo const &;
|
||||
CT_ASSERT(std::is_same<test, expect>::value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,4 +45,4 @@ bool PP_CAT(test_, CALLABLE_TRAIT_UNDER_TEST)() {
|
||||
return true;
|
||||
}
|
||||
|
||||
auto PP_CAT(var_, CALLABLE_TRAIT_UNDER_TEST) = PP_CAT(test_, CALLABLE_TRAIT_UNDER_TEST)();
|
||||
auto PP_CAT(var_, CALLABLE_TRAIT_UNDER_TEST) = PP_CAT(test_, CALLABLE_TRAIT_UNDER_TEST)();
|
||||
|
||||
@@ -1,51 +1,51 @@
|
||||
/*
|
||||
Copyright Barrett Adair 2016-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 <boost/callable_traits/remove_transaction_safe.hpp>
|
||||
#include <tuple>
|
||||
#include "test.hpp"
|
||||
|
||||
#ifndef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE
|
||||
int main(){}
|
||||
#else
|
||||
|
||||
template<typename T>
|
||||
struct is_substitution_failure_remove_tx_safe {
|
||||
|
||||
template<typename>
|
||||
static auto test(...) -> std::true_type;
|
||||
|
||||
template<typename A,
|
||||
typename std::remove_reference<
|
||||
TRAIT(remove_transaction_safe, A)>::type* = nullptr>
|
||||
static auto test(int) -> std::false_type;
|
||||
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
struct foo;
|
||||
|
||||
int main() {
|
||||
|
||||
auto lambda = [](){};
|
||||
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<decltype(lambda)>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<decltype(lambda)&>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<int>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<int &>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<int (* const &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<int (foo::* &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<int (foo::* const)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<int (foo::* const &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<int (foo::* volatile)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<void>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<void*>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<void(**)()>::value);
|
||||
}
|
||||
|
||||
#endif //#ifndef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE
|
||||
/*
|
||||
Copyright Barrett Adair 2016-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 <boost/callable_traits/remove_transaction_safe.hpp>
|
||||
#include <tuple>
|
||||
#include "test.hpp"
|
||||
|
||||
#ifndef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE
|
||||
int main(){}
|
||||
#else
|
||||
|
||||
template<typename T>
|
||||
struct is_substitution_failure_remove_tx_safe {
|
||||
|
||||
template<typename>
|
||||
static auto test(...) -> std::true_type;
|
||||
|
||||
template<typename A,
|
||||
typename std::remove_reference<
|
||||
TRAIT(remove_transaction_safe, A)>::type* = nullptr>
|
||||
static auto test(int) -> std::false_type;
|
||||
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
struct foo;
|
||||
|
||||
int main() {
|
||||
|
||||
auto lambda = [](){};
|
||||
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<decltype(lambda)>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<decltype(lambda)&>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<int>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<int &>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<int (* const &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<int (foo::* &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<int (foo::* const)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<int (foo::* const &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<int (foo::* volatile)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<void>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<void*>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_tx_safe<void(**)()>::value);
|
||||
}
|
||||
|
||||
#endif //#ifndef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
/*
|
||||
Copyright Barrett Adair 2016-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 <boost/callable_traits/remove_varargs.hpp>
|
||||
#include <tuple>
|
||||
#include "test.hpp"
|
||||
|
||||
struct foo;
|
||||
|
||||
template<typename T>
|
||||
struct is_substitution_failure_remove_varargs {
|
||||
|
||||
template<typename>
|
||||
static auto test(...) -> std::true_type;
|
||||
|
||||
template<typename A,
|
||||
typename std::remove_reference<
|
||||
TRAIT(add_varargs, A)>::type* = nullptr>
|
||||
static auto test(int) -> std::false_type;
|
||||
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
int main() {
|
||||
|
||||
auto lambda = [](){};
|
||||
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<decltype(lambda)>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<decltype(lambda)&>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<int>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<int &>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<int (* const &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<int (foo::* &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<int (foo::* const)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<int (foo::* const &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<int (foo::* volatile)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<void>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<void*>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<void(**)()>::value);
|
||||
}
|
||||
/*
|
||||
Copyright Barrett Adair 2016-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 <boost/callable_traits/remove_varargs.hpp>
|
||||
#include <tuple>
|
||||
#include "test.hpp"
|
||||
|
||||
struct foo;
|
||||
|
||||
template<typename T>
|
||||
struct is_substitution_failure_remove_varargs {
|
||||
|
||||
template<typename>
|
||||
static auto test(...) -> std::true_type;
|
||||
|
||||
template<typename A,
|
||||
typename std::remove_reference<
|
||||
TRAIT(add_varargs, A)>::type* = nullptr>
|
||||
static auto test(int) -> std::false_type;
|
||||
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
|
||||
int main() {
|
||||
|
||||
auto lambda = [](){};
|
||||
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<decltype(lambda)>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<decltype(lambda)&>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<int>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<int &>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<int (* const &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<int (foo::* &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<int (foo::* const)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<int (foo::* const &)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<int (foo::* volatile)()>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<void>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<void*>::value);
|
||||
CT_ASSERT(is_substitution_failure_remove_varargs<void(**)()>::value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user