kblib 0.2.3
General utilities library for modern C++
|
This header provides some features of C++17 <type_traits> and other headers for C++14, as well as some other traits. More...
#include "tdecl.h"
#include <array>
#include <limits>
#include <memory>
#include <type_traits>
#include <utility>
Go to the source code of this file.
Namespaces | |
namespace | kblib |
The main namespace in which all entities from kblib are defined. | |
namespace | kblib::detail |
The namespace used for implementation details within kblib. | |
namespace | kblib::fakestd |
A namespace which holds all the C++14 implementations of C++17 standard library features. In C++17, it is simply defined as an alias to std. | |
namespace | kblib::fakestd::detail |
Implementation details for kblib::fakestd features. | |
Macros | |
#define | KBLIB_FAKESTD (__cplusplus < 201703L) |
Typedefs | |
template<class T , class = std::enable_if_t<std::is_pointer<T>::value>> | |
using | kblib::owner = T |
template<bool B, typename T = void> | |
using | kblib::enable_if_t = typename std::enable_if< B, T >::type |
template<typename T > | |
using | kblib::decay_t = typename std::decay< T >::type |
template<typename T > | |
using | kblib::remove_cvref_t = typename std::remove_reference< typename std::remove_cv< T >::type >::type |
template<bool v> | |
using | kblib::bool_constant = std::integral_constant< bool, v > |
template<typename F , typename... ArgTypes> | |
using | kblib::fakestd::invoke_result_t = typename invoke_result< F, ArgTypes... >::type |
template<typename... Ts> | |
using | kblib::fakestd::void_t = typename make_void< Ts... >::type |
template<class Fp , class... Args> | |
using | kblib::fakestd::detail::invokable = invokable_r< void, Fp, Args... > |
template<class Ret , class Fp , class... Args> | |
using | kblib::fakestd::detail::nothrow_invokable_r = nothrow_invokable_r_imp< invokable_r< Ret, Fp, Args... >::value, std::is_void< Ret >::value, Ret, Fp, Args... > |
template<class Fp , class... Args> | |
using | kblib::fakestd::detail::nothrow_invokable = nothrow_invokable_r_imp< invokable< Fp, Args... >::value, true, void, Fp, Args... > |
template<typename... Ts> | |
using | kblib::meta_type_t = typename meta_type< Ts... >::type |
template<bool b> | |
using | kblib::void_if_t = typename void_if< b >::type |
template<typename T > | |
using | kblib::metafunction_value_t = std::integral_constant< decltype(T::value), T::value > |
template<bool V, typename T > | |
using | kblib::return_assert_t = typename return_assert< V, T >::type |
template<typename N > | |
using | kblib::detail::make_smap_el = type_map_el< static_cast< std::intmax_t >(msb_possible< N >()), N > |
template<typename N > | |
using | kblib::detail::filter_signed_t = typename filter_signed< N >::type |
template<typename N > | |
using | kblib::detail::filter_unsigned_t = typename filter_unsigned< N >::type |
template<typename N > | |
using | kblib::safe_signed_t = typename safe_signed< N >::type |
template<typename C , typename V > | |
using | kblib::copy_const_t = typename copy_const< C, V >::type |
template<typename T > | |
using | kblib::value_detected_t = typename value_detected< T >::type |
template<typename T > | |
using | kblib::key_detected_t = typename key_detected< T >::type |
template<typename T > | |
using | kblib::mapped_detected_t = typename mapped_detected< T >::type |
template<typename T > | |
using | kblib::hash_detected_t = typename hash_detected< T >::type |
template<typename Container > | |
using | kblib::value_type_linear_t = typename value_type_linear< Container >::type |
template<typename Container > | |
using | kblib::key_type_setlike_t = typename key_type_setlike< Container >::type |
Functions | |
template<typename F , typename... Args, enable_if_t< not std::is_member_pointer< remove_cvref_t< F > >::value, int > = 0> | |
constexpr auto | kblib::detail::do_invoke (F &&f, Args &&... args) noexcept(noexcept(std::forward< F >(f)(std::forward< Args >(args)...))) -> decltype(auto) |
template<typename F , typename Object , typename... Args, enable_if_t< not std::is_pointer< remove_cvref_t< Object > >::value and std::is_member_function_pointer< F >::value, int > = 0> | |
constexpr auto | kblib::detail::do_invoke (F f, Object &&obj, Args &&... args) noexcept(noexcept((std::forward< Object >(obj).*f)(std::forward< Args >(args)...))) -> decltype(auto) |
template<typename F , typename Pointer , typename... Args, enable_if_t< std::is_pointer< Pointer >::value and std::is_member_function_pointer< F >::value, int > = 0> | |
constexpr auto | kblib::detail::do_invoke (F f, Pointer ptr, Args &&... args) noexcept(noexcept((ptr-> *f)(std::forward< Args >(args)...))) -> decltype(auto) |
template<typename Member , typename Object , enable_if_t< not std::is_pointer< remove_cvref_t< Object > >::value and std::is_member_object_pointer< Member >::value, int > = 0> | |
constexpr auto | kblib::detail::do_invoke (Member mem, Object &&obj) noexcept -> decltype(auto) |
template<typename Member , typename Pointer , enable_if_t< std::is_pointer< Pointer >::value and std::is_member_object_pointer< Member >::value, int > = 0> | |
constexpr auto | kblib::detail::do_invoke (Member mem, Pointer ptr) noexcept -> decltype(auto) |
template<typename F , typename... Args> | |
constexpr auto | kblib::invoke (F &&f, Args &&... args) noexcept(noexcept(detail::do_invoke(std::forward< F >(f), std::forward< Args >(args)...))) -> decltype(auto) |
template<typename F > | |
auto | kblib::fakestd::not_fn (F &&f) -> detail::not_fn_t< F > |
template<class ForwardIt > | |
constexpr auto | kblib::fakestd::max_element (ForwardIt first, ForwardIt last) -> ForwardIt |
template<class ForwardIt , class Compare > | |
constexpr auto | kblib::fakestd::max_element (ForwardIt first, ForwardIt last, Compare comp) -> ForwardIt |
template<class C > | |
constexpr auto | kblib::fakestd::size (const C &c) -> decltype(c.size()) |
template<class T , std::size_t N> | |
constexpr auto | kblib::fakestd::size (const T(&)[N]) noexcept -> std::size_t |
template<typename F , typename Arg > | |
constexpr auto | kblib::apply (F &&f, Arg &&arg) noexcept(noexcept(detail::apply_impl< F, Arg >::do_apply(std::forward< F >(f), std::forward< Arg >(arg), std::index_sequence< std::tuple_size< Arg >::value >{}))) -> decltype(auto) |
template<typename T > | |
auto | kblib::to_unique (owner< T * > p) -> std::unique_ptr< T > |
template<typename T , typename D > | |
auto | kblib::to_unique (owner< T * > p, D &&d) -> std::unique_ptr< T, D > |
template<typename I > | |
constexpr auto | kblib::to_unsigned (I x) -> std::make_unsigned_t< I > |
Cast integral argument to corresponding unsigned type. More... | |
template<typename I > | |
constexpr auto | kblib::to_signed (I x) -> std::make_signed_t< I > |
Cast integral argument to corresponding signed type. More... | |
template<typename A , typename F > | |
constexpr auto | kblib::signed_cast (F x) -> enable_if_t< std::is_integral< A >::value and std::is_integral< F >::value and std::is_signed< A >::value, std::make_signed_t< F > > |
Cast argument to equivalently-sized type with the same signednessas the template parameter. More... | |
template<typename... Ts> | |
constexpr auto | kblib::detail::ignore (Ts &&...) noexcept -> void |
template<typename T , std::size_t... Is> | |
constexpr auto | kblib::detail::swap_tuple_impl (T &a, T &b, std::index_sequence< Is... >) noexcept(noexcept(ignore(((void) swap(std::get< Is >(a), std::get< Is >(b)), 0)...))) -> void |
template<typename T , typename U = T> | |
constexpr auto | kblib::exchange (T &obj, U &&new_value) -> T |
constexpr auto | kblib::detail::msb (std::uintmax_t x) -> std::uintmax_t |
template<typename Num > | |
constexpr auto | kblib::detail::msb_possible () -> Num |
template<typename N > | |
constexpr auto | kblib::signed_promote (N x) noexcept -> safe_signed_t< N > |
template<class InputIt1 , class InputIt2 > | |
constexpr auto | kblib::equal (InputIt1 first1, InputIt1 last1, InputIt2 first2) -> bool |
template<typename InputIt1 , typename InputIt2 , typename BinaryPredicate , typename kblib::enable_if_t< not std::is_same< InputIt2, BinaryPredicate >::value, int > = 0> | |
constexpr auto | kblib::equal (InputIt1 first1, InputIt1 last1, InputIt2 first2, BinaryPredicate p) -> bool |
template<class RandomIt1 , class RandomIt2 , typename kblib::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< RandomIt1 >::iterator_category >::value and std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< RandomIt2 >::iterator_category >::value, int > = 0> | |
constexpr auto | kblib::equal (RandomIt1 first1, RandomIt1 last1, RandomIt2 first2, RandomIt2 last2) -> bool |
template<class RandomIt1 , class RandomIt2 , typename BinaryPredicate , typename kblib::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< RandomIt1 >::iterator_category >::value and std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< RandomIt2 >::iterator_category >::value, int > = 0> | |
constexpr auto | kblib::equal (RandomIt1 first1, RandomIt1 last1, RandomIt2 first2, RandomIt2 last2, BinaryPredicate p) -> bool |
template<class InputIt1 , class InputIt2 , typename kblib::enable_if_t< not std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< InputIt1 >::iterator_category >::value or not std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< InputIt2 >::iterator_category >::value, int > = 0> | |
constexpr auto | kblib::equal (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2) -> bool |
template<typename InputIt1 , typename InputIt2 , typename BinaryPredicate , typename kblib::enable_if_t< not std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< InputIt1 >::iterator_category >::value or not std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< InputIt2 >::iterator_category >::value, int > = 0> | |
constexpr auto | kblib::equal (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, BinaryPredicate p) -> bool |
template<typename C > | |
constexpr auto | kblib::size (const C &c) -> decltype(c.size()) |
template<typename T , std::size_t N> | |
constexpr auto | kblib::size (const T(&)[N]) noexcept -> std::size_t |
template<class InputIt1 , class InputIt2 > | |
constexpr auto | kblib::lexicographical_compare (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2) -> bool |
Variables | |
template<class Tp , class Up > | |
constexpr bool | kblib::fakestd::is_swappable_with_v = is_swappable_with<Tp, Up>::value |
template<class Tp > | |
constexpr bool | kblib::fakestd::is_swappable_v = is_swappable<Tp>::value |
template<class Tp , class Up > | |
constexpr bool | kblib::fakestd::is_nothrow_swappable_with_v = is_nothrow_swappable_with<Tp, Up>::value |
template<class Tp > | |
constexpr bool | kblib::fakestd::is_nothrow_swappable_v = is_nothrow_swappable<Tp>::value |
template<class Fn , class... Args> | |
constexpr bool | kblib::fakestd::is_invocable_v = is_invocable<Fn, Args...>::value |
template<class Ret , class Fn , class... Args> | |
constexpr bool | kblib::fakestd::is_invocable_r_v = is_invocable_r<Ret, Fn, Args...>::value |
template<class Fn , class... Args> | |
constexpr bool | kblib::fakestd::is_nothrow_invocable_v = is_nothrow_invocable<Fn, Args...>::value |
template<class Ret , class Fn , class... Args> | |
constexpr bool | kblib::fakestd::is_nothrow_invocable_r_v = is_nothrow_invocable_r<Ret, Fn, Args...>::value |
struct { | |
} | kblib::swap |
template<typename T > | |
constexpr std::intmax_t | kblib::detail::max_val = std::numeric_limits<T>::max() |
template<typename T > | |
constexpr bool | kblib::value_detected_v = value_detected<T>::value |
template<typename T > | |
constexpr bool | kblib::key_detected_v = key_detected<T>::value |
template<typename T > | |
constexpr bool | kblib::mapped_detected_v = mapped_detected<T>::value |
template<typename T > | |
constexpr bool | kblib::hash_detected_v = hash_detected<T>::value |
constexpr struct kblib::in_place_agg_t | kblib::in_place_agg |
This header provides some features of C++17 <type_traits> and other headers for C++14, as well as some other traits.
Definition in file fakestd.h.