kblib 0.2.3
General utilities library for modern C++
traits.h File Reference

Contains some type traits not in the standard library that are useful in the implementation of kblib. More...

#include "fakestd.h"
#include "tdecl.h"
#include <array>
#include <cstring>
#include <tuple>
#include <type_traits>
Include dependency graph for traits.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  kblib::contains_type< std::tuple< T, Ts... >, U >
 
struct  kblib::contains_type< std::tuple< T, Ts... >, T >
 
struct  kblib::contains_type< std::tuple<>, T >
 
struct  kblib::contains_types< Tuple, std::tuple< T, Ts... > >
 
struct  kblib::contains_types< Tuple, std::tuple<> >
 
struct  kblib::list_as_tuple< Tuple< Ts... > >
 
struct  kblib::is_unbounded_array< T >
 
struct  kblib::is_unbounded_array< T[]>
 
struct  kblib::is_bounded_array< T >
 
struct  kblib::is_bounded_array< T[N]>
 
struct  kblib::ignore< typename, T >
 Ignores its first template argument entirely, and returns its second. More...
 
struct  kblib::is_resizable< C >
 
struct  kblib::has_reserve< C >
 True if and only if C contains an accessible reserve() member. More...
 
struct  kblib::is_contiguous< C >
 
struct  kblib::class_of< M T::* >
 
struct  kblib::member_of< M T::* >
 
struct  kblib::return_type< R(Args...)>
 
struct  kblib::return_type< R(Args...) const >
 
struct  kblib::return_type< R(Args...) volatile >
 
struct  kblib::return_type< R(Args...) const volatile >
 
struct  kblib::exists< T >
 
struct  kblib::is_input_iterator< T, typename >
 
struct  kblib::is_input_iterator< T, void_if_t< std::is_base_of< std::input_iterator_tag, typename std::iterator_traits< T >::iterator_category >::value > >
 
struct  kblib::is_forward_iterator< T, typename >
 
struct  kblib::is_forward_iterator< T, void_if_t< std::is_base_of< std::forward_iterator_tag, typename std::iterator_traits< T >::iterator_category >::value > >
 
struct  kblib::is_bidirectional_iterator< T, typename >
 
struct  kblib::is_bidirectional_iterator< T, void_if_t< std::is_base_of< std::bidirectional_iterator_tag, typename std::iterator_traits< T >::iterator_category >::value > >
 
struct  kblib::is_random_access_iterator< T, typename >
 
struct  kblib::is_random_access_iterator< T, void_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< T >::iterator_category >::value > >
 
struct  kblib::iterator_type_for< T[N], void >
 
struct  kblib::iterator_type_for< Range, void_t< decltype(begin(std::declval< Range & >()))> >
 
struct  kblib::is_iterable< Range, typename >
 
struct  kblib::is_iterable< Range, void_if_t< is_input_iterator< decltype(begin(std::declval< Range & >()))>::value > >
 
struct  kblib::is_iterable< T[N], void >
 
struct  kblib::is_iterable< T(&)[N], void >
 
struct  kblib::is_iterator< T, typename >
 
struct  kblib::is_iterator< T, void_t< decltype(*std::declval< T & >(), void(),++std::declval< T & >())> >
 
struct  kblib::type_constant< T, V >
 
struct  kblib::is_aliasing_type< T >
 
struct  kblib::is_aliasing_type< char >
 
struct  kblib::is_aliasing_type< unsigned char >
 

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.
 

Typedefs

template<typename T >
using kblib::alias = T
 A simple identity alias for simplifying some compound type declarations, such as function pointers. More...
 
template<typename U , typename T >
using kblib::ignore_t = typename ignore< U, T >::type
 An alias for ignore<U, T>::type. More...
 
template<typename T >
using kblib::class_of_t = typename class_of< T >::type
 
template<typename T >
using kblib::member_of_t = typename member_of< T >::type
 
template<typename Range >
using kblib::iterator_type_for_t = typename iterator_type_for< Range >::type
 
template<typename T >
using kblib::remove_reference_t = typename std::remove_reference< T >::type
 Abbreviated name for std::remove_reference<T>::type for C++14. More...
 

Functions

template<typename T , int N, int... I>
constexpr auto kblib::detail::trim_array (const T(&arr)[N], std::integer_sequence< int, I... >) -> std::array< T, std::integer_sequence< int, I... >::size()>
 Truncates an array to its first N elements. More...
 
template<int trim, typename T , int N, typename Indices = std::make_integer_sequence<int, N - trim>>
constexpr auto kblib::trim_array (const T(&arr)[N]) -> std::array< T, N - trim >
 Truncates the last trim elements from an array. More...
 
template<int N, typename Indices = std::make_integer_sequence<int, N - 1>>
constexpr auto kblib::remove_null_terminator (const char(&arr)[N]) -> std::array< char, N - 1 >
 Creates an array of only the meaningful characters in a string literal, and not the null terminator. More...
 
template<typename T , typename F >
auto kblib::byte_cast (F v) noexcept -> T
 Creates a T with the same object representation as the given F. More...
 
template<typename C , typename = decltype(std::declval<C&>().resize(0))>
auto kblib::detail::calc_resizable (int) noexcept -> std::true_type
 
template<typename >
auto kblib::detail::calc_resizable (...) noexcept -> std::false_type
 
template<typename C , typename std::enable_if< has_reserve_v< C >, int >::type = 0>
auto kblib::try_reserve (C &c, std::size_t s) noexcept(noexcept(c.reserve(s))) -> void
 Attempt to reserve capacity in a container. No-op if unsupported. More...
 

Variables

template<typename... Ts>
KBLIB_CONSTANT_V kblib::contains_type_v = contains_type<Ts...>::value
 
template<typename... Ts>
KBLIB_CONSTANT_V kblib::contains_types_v = contains_types<Ts...>::value
 
template<typename C >
KBLIB_CONSTANT_V kblib::is_resizable_v = decltype(detail::calc_resizable<C>(0))::value
 
template<typename C , typename = void>
KBLIB_CONSTANT_V kblib::has_reserve_v = false
 
template<typename C , typename = void>
KBLIB_CONSTANT_V kblib::is_contiguous_v = false
 Type trait to determine if a container is contiguous. More...
 
template<typename T >
KBLIB_CONSTANT_V kblib::is_input_iterator_v = is_input_iterator<T>::value
 
template<typename T >
KBLIB_CONSTANT_V kblib::is_forward_iterator_v = is_forward_iterator<T>::value
 
template<typename T >
KBLIB_CONSTANT_V kblib::is_bidirectional_iterator_v = is_bidirectional_iterator<T>::value
 
template<typename T >
KBLIB_CONSTANT_V kblib::is_random_access_iterator_v = is_random_access_iterator<T>::value
 
template<typename T >
KBLIB_CONSTANT_V kblib::is_iterable_v = is_iterable<T>::value
 
template<typename T >
KBLIB_CONSTANT_V kblib::is_iterator_v = is_iterator<T>::value
 
template<typename T >
KBLIB_CONSTANT_V kblib::is_reference_v = std::is_reference<T>::value
 Abbreviated name for std::is_reference<T>::value for C++14. More...
 
template<typename CharT = char>
KBLIB_CONSTANT auto kblib::eof = std::char_traits<CharT>::eof()
 Names the EOF value for the given character type in std::char_traits. More...
 
template<typename T >
KBLIB_CONSTANT_V kblib::is_aliasing_type_v = is_aliasing_type<T>::value
 

Detailed Description

Contains some type traits not in the standard library that are useful in the implementation of kblib.

Author
killerbee
Date
2019-2021

Definition in file traits.h.