Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions example/intro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ Distributed under the Boost Software License, Version 1.0.
->*/

#include <boost/callable_traits/detail/config.hpp>
#ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
int main(){ return 0; }
#else

//[ intro
#include <type_traits>
Expand Down Expand Up @@ -59,4 +56,3 @@ int main() {
}

//]
#endif
2 changes: 1 addition & 1 deletion example/is_invocable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace ct = boost::callable_traits;

struct foo {
template<typename T>
typename std::enable_if<std::is_integral<T>::value>::type
std::enable_if_t<std::is_integral<T>::value>
operator()(T){}
};

Expand Down
2 changes: 1 addition & 1 deletion include/boost/callable_traits/apply_member_pointer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace detail {

template<typename T, typename C>
struct make_member_pointer<T, C, true> {
using type = typename std::remove_reference<T>::type C::*;
using type = std::remove_reference_t<T> C::*;
};

template<typename C>
Expand Down
10 changes: 0 additions & 10 deletions include/boost/callable_traits/detail/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,12 @@ Distributed under the Boost Software License, Version 1.0.
# endif // #if !defined( __clang__ )
#endif // #ifdef _MSC_VER

#define BOOST_CLBL_TRTS_IX_SEQ(...) ::std::index_sequence< __VA_ARGS__ >
#define BOOST_CLBL_TRTS_MAKE_IX_SEQ(...) ::std::make_index_sequence< __VA_ARGS__ >
#define BOOST_CLBL_TRTS_DISJUNCTION(...) ::std::disjunction< __VA_ARGS__ >

#ifndef __cpp_variable_templates
# define BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
#endif

#ifndef __cpp_lib_logical_traits
# include <boost/callable_traits/detail/polyfills/disjunction.hpp>
#endif //__cpp_lib_logical_traits

#ifndef __cpp_lib_integer_sequence
# include <boost/callable_traits/detail/polyfills/make_index_sequence.hpp>
#endif // __cpp_lib_integer_sequence

#if defined(BOOST_CLBL_TRTS_MSVC) && !defined(BOOST_DISABLE_WIN32)
# define BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC __cdecl
# define BOOST_CLBL_TRTS_PMF_VARGARGS_CDECL_DEFAULT
Expand Down
14 changes: 7 additions & 7 deletions include/boost/callable_traits/detail/default_callable_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ struct default_callable_traits {
// everything else into member data pointers.
template<typename C,
typename U = T,
typename K = typename std::remove_reference<U>::type,
typename L = typename std::conditional<
std::is_same<void, K>::value, error_t, K>::type,
typename Class = typename std::conditional<
std::is_class<C>::value, C, error_t>::type>
using apply_member_pointer = typename std::conditional<
typename K = std::remove_reference_t<U>,
typename L = std::conditional_t<
std::is_same<void, K>::value, error_t, K>,
typename Class = std::conditional_t<
std::is_class_v<C>, C, error_t>>
using apply_member_pointer = std::conditional_t<
std::is_same<L, error_t>::value || std::is_same<Class, error_t>::value,
error_t, L Class::*>::type;
error_t, L Class::*>;

// Changes the return type of PMFs, function pointers, function
// references, and qualified/unqualified function types. Changes
Expand Down
10 changes: 5 additions & 5 deletions include/boost/callable_traits/detail/forward_declarations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ struct callable_dummy {
};

template<typename T>
using default_to_function_object = typename std::conditional<
using default_to_function_object = std::conditional_t<
has_normal_call_operator<T>::value,
T, callable_dummy>::type;
T, callable_dummy>;

template<typename T>
struct pmf;

template<typename T>
struct pmd;

template<typename F, typename T = typename std::remove_reference<F>::type>
using function_object_base = typename std::conditional<
template<typename F, typename T = std::remove_reference_t<F>>
using function_object_base = std::conditional_t<
has_normal_call_operator<T>::value,
pmf<decltype(&default_to_function_object<T>::operator())>,
default_callable_traits<T>>::type;
default_callable_traits<T>>;

template<typename T, typename Base = function_object_base<T>>
struct function_object;
Expand Down
2 changes: 1 addition & 1 deletion include/boost/callable_traits/detail/function.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ template<typename T>
struct function<T&> : std::conditional<function<T>::value,
function<T>, default_callable_traits<T&>>::type {

static constexpr const bool value = !std::is_pointer<T>::value;
static constexpr const bool value = !std::is_pointer_v<T>;

using traits = function;
using base = function<T>;
Expand Down
7 changes: 3 additions & 4 deletions include/boost/callable_traits/detail/function_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ struct function_object : Base {
using arg_types = typename Base::non_invoke_arg_types;
using non_invoke_arg_types = arg_types;

static constexpr const bool value = std::is_class<
typename std::remove_reference<T>::type>::value;
static constexpr const bool value = std::is_class_v<
std::remove_reference_t<T>>;

using traits = function_object;
using class_type = error_t;
Expand Down Expand Up @@ -54,8 +54,7 @@ struct function_object : Base {
expand_args_right<Container, LeftArgs...>;

template<typename C, typename U = T>
using apply_member_pointer =
typename std::remove_reference<U>::type C::*;
using apply_member_pointer = std::remove_reference_t<U> C::*;

template<typename>
using apply_return = error_t;
Expand Down
6 changes: 3 additions & 3 deletions include/boost/callable_traits/detail/is_invocable_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace boost { namespace callable_traits { namespace detail {

template<typename U>
static std::int8_t test(
check<typename std::remove_reference<decltype(*std::declval<U>())>::type>*
check<std::remove_reference_t<decltype(*std::declval<U>())>>*
);

template<typename>
Expand Down Expand Up @@ -69,8 +69,8 @@ namespace boost { namespace callable_traits { namespace detail {
template<typename Base, typename T,
typename IsBaseOf = std::is_base_of<Base, shallow_decay<T>>,
typename IsSame = std::is_same<Base, shallow_decay<T>>>
using generalize_if_dissimilar = typename std::conditional<
IsBaseOf::value || IsSame::value, T, generalize<T>>::type;
using generalize_if_dissimilar = std::conditional_t<
IsBaseOf::value || IsSame::value, T, generalize<T>>;

template<typename Traits, bool = Traits::is_const_member::value
|| Traits::is_volatile_member::value
Expand Down
16 changes: 8 additions & 8 deletions include/boost/callable_traits/detail/parameter_index_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ struct parameter_index_helper {

using error_t = error_type<T>;

using args_tuple = typename std::conditional<IgnoreThisPointer,
using args_tuple = std::conditional_t<IgnoreThisPointer,
typename detail::traits<T>::non_invoke_arg_types,
typename detail::traits<T>::arg_types>::type;
typename detail::traits<T>::arg_types>;

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;
using temp_tuple = std::conditional_t<has_parameter_list,
args_tuple, std::tuple<error_t>>;

static constexpr std::size_t parameter_list_size =
std::tuple_size<temp_tuple>::value;
Expand All @@ -37,13 +37,13 @@ struct parameter_index_helper {
static constexpr std::size_t count =
has_parameter_list && !is_count_out_of_range ? Count : 0;

using permissive_tuple = typename std::conditional<
using permissive_tuple = std::conditional_v<
has_parameter_list && !is_out_of_range,
args_tuple, std::tuple<error_t>>::type;
args_tuple, std::tuple<error_t>>;

using permissive_function = typename std::conditional<
using permissive_function = std::conditional_v<
has_parameter_list && !is_out_of_range,
T, error_t(error_t)>::type;
T, error_t(error_t)>;
};

}}} // namespace boost::callable_traits::detail
Expand Down
4 changes: 2 additions & 2 deletions include/boost/callable_traits/detail/pmd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ struct pmd<D T::*> : default_callable_traits<> {
using class_type = T;
using invoke_type = T const &;
using type = D T::*;
using function_type = typename std::add_lvalue_reference<D>::type(invoke_type);
using function_type = std::add_lvalue_reference_t<D>(invoke_type);
using qualified_function_type = D(invoke_type);
using arg_types = std::tuple<invoke_type>;
using non_invoke_arg_types = std::tuple<>;

using return_type = typename std::add_lvalue_reference<D>::type;
using return_type = std::add_lvalue_reference_t<D>;

template<typename C>
using apply_member_pointer = D C::*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct disjunction<T> : T {};

template<typename T, typename... Ts>
struct disjunction<T, Ts...>
: std::conditional<T::value != false, T, disjunction<Ts...>>::type {};
: std::conditional_t<bool(T::value), T, disjunction<Ts...>> {};

}}} // namespace boost::callable_traits::detail

Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion include/boost/callable_traits/detail/qualifier_flags.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ template<qualifier_flags Flags>
using remove_volatile_flag = std::integral_constant<
qualifier_flags, Flags & ~volatile_>;

template<typename U, typename T = typename std::remove_reference<U>::type>
template<typename U, typename T = std::remove_reference_t<U>>
using cv_of = std::integral_constant<qualifier_flags,
(std::is_const<T>::value ? const_ : default_)
| (std::is_volatile<T>::value ? volatile_ : default_)>;
Expand Down
4 changes: 2 additions & 2 deletions include/boost/callable_traits/detail/sfinae_errors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ namespace boost { namespace callable_traits { namespace detail {

template<typename FailMsg, typename ForceTwoPhaseLookup>
struct fail {
using type = typename std::conditional<std::is_same<ForceTwoPhaseLookup, std::false_type>::value,
FailMsg, FailMsg>::type::_::type;
using type = std::conditional_t<std::is_same<ForceTwoPhaseLookup, std::false_type>::value,
FailMsg, FailMsg>::_::type;
};

}}} // namespace boost::callable_traits::detail
Expand Down
6 changes: 3 additions & 3 deletions include/boost/callable_traits/detail/unguarded/pmf_4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ struct pmf<Return(BOOST_CLBL_TRTS_CC T::*)(Args...)
BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
BOOST_CLBL_TRTS_NOEXCEPT_SPEC;

using invoke_type = typename std::conditional<
using invoke_type = std::conditional_t<
std::is_rvalue_reference<T BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS>::value,
T BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS,
typename std::add_lvalue_reference<T BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS>::type
>::type;
std::add_lvalue_reference_t<T BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS>
>;

using arg_types = std::tuple<invoke_type, Args...>;
using non_invoke_arg_types = std::tuple<Args...>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ struct pmf<Return(BOOST_CLBL_TRTS_VARARGS_CC T::*)(Args..., ...)
BOOST_CLBL_TRTS_INCLUDE_TRANSACTION_SAFE
BOOST_CLBL_TRTS_NOEXCEPT_SPEC;

using invoke_type = typename std::conditional<
using invoke_type = std::conditional_t<
std::is_rvalue_reference<T BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS>::value,
T BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS,
typename std::add_lvalue_reference<T BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS>::type
>::type;
std::add_lvalue_reference_t<T BOOST_CLBL_TRTS_INCLUDE_QUALIFIERS>
>;

using arg_types = std::tuple<invoke_type, Args...>;
using non_invoke_arg_types = std::tuple<Args...>;
Expand Down
21 changes: 10 additions & 11 deletions include/boost/callable_traits/detail/utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ struct invalid_type { invalid_type() = delete; };
struct reference_error { reference_error() = delete; };

template<typename T>
using error_type = typename std::conditional<
std::is_reference<T>::value, reference_error, invalid_type>::type;
using error_type = std::conditional_t<
std::is_reference<T>::value, reference_error, invalid_type>;

#ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
struct abominable_functions_not_supported_on_this_compiler{};
Expand All @@ -42,7 +42,7 @@ using bool_type = std::integral_constant<bool, Value>;

// shorthand for std::tuple_element
template<std::size_t I, typename Tup>
using at = typename std::tuple_element<I, Tup>::type;
using at = std::tuple_element_t<I, Tup>;

template<typename T, typename Class>
using add_member_pointer = T Class::*;
Expand All @@ -51,32 +51,31 @@ template<typename L, typename R, typename ErrorType>
using fail_when_same = fail_if<std::is_same<L, R>::value, ErrorType>;

template<typename T, typename ErrorType,
typename U = typename std::remove_reference<T>::type>
typename U = std::remove_reference_t<T>>
using try_but_fail_if_invalid = sfinae_try<T,
fail_when_same<U, invalid_type, ErrorType>,
fail_when_same<U, reference_error,
reference_type_not_supported_by_this_metafunction>>;

template<typename T, typename ErrorType,
typename U = typename std::remove_reference<T>::type,
typename U = std::remove_reference_t<T>,
bool is_reference_error = std::is_same<reference_error, U>::value>
using fail_if_invalid = fail_if<
std::is_same<U, invalid_type>::value || is_reference_error,
typename std::conditional<is_reference_error,
reference_type_not_supported_by_this_metafunction, ErrorType>::type>;
std::conditional_t<is_reference_error,
reference_type_not_supported_by_this_metafunction, ErrorType>>;

template<typename T, typename Fallback>
using fallback_if_invalid = typename std::conditional<
std::is_same<T, invalid_type>::value, Fallback, T>::type;
using fallback_if_invalid = std::conditional_t<
std::is_same<T, invalid_type>::value, Fallback, T>;

template<typename T, template<class> class Alias, typename U = Alias<T>>
struct force_sfinae {
using type = U;
};

template<typename T>
using shallow_decay = typename std::remove_cv<
typename std::remove_reference<T>::type>::type;
using shallow_decay = std::remove_cv_t<std::remove_reference_t<T>>;

template<typename T>
struct is_reference_wrapper_t {
Expand Down
Loading