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

Provides general utilities which do not fit in any more specific header. More...

#include "iterators.h"
#include <bitset>
#include <climits>
#include <cstdint>
#include <initializer_list>
#include <limits>
#include <numeric>
#include <utility>
Include dependency graph for simple.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  kblib::detail_simple::simple_range< T >
 
struct  kblib::RAII_wrapper< T >
 
struct  kblib::first_bigger_than< size, T, Ts >
 
struct  kblib::first_bigger_than< size, T >
 
struct  kblib::identity
 The identity function, as a function object. More...
 

Namespaces

namespace  kblib
 The main namespace in which all entities from kblib are defined.
 
namespace  kblib::detail_simple
 

Macros

#define KBLIB_DEBUG_LOG_RANGES   0
 

Typedefs

template<std::uintmax_t I>
using kblib::uint_smallest = typename first_bigger_than< 1+filg2(I)/CHAR_BIT, unsigned char, unsigned short, unsigned int, unsigned long, unsigned long long, std::uintmax_t >::type
 
template<std::uintmax_t I>
using kblib::int_smallest = typename first_bigger_than< 1+(filg2(I)+1)/CHAR_BIT, signed char, signed short, signed int, signed long, signed long long, std::uintmax_t >::type
 
template<std::uintmax_t I>
using kblib::uint_smallest_t = typename uint_smallest< I >::type
 
template<std::uintmax_t I>
using kblib::int_smallest_t = typename int_smallest< I >::type
 

Functions

template<typename T >
constexpr auto kblib::in_range (const T &v, detail_simple::simple_range< T > r)
 
template<typename T >
constexpr auto kblib::in_range_i (const T &v, detail_simple::simple_range< T > r)
 
template<typename F , typename... T>
auto kblib::map (F f, T &&... t) noexcept(noexcept(std::tuple{ kblib::apply(f, std::forward< T >(t))...})) -> enable_if_t< not any_void< decltype(kblib::apply(f, std::forward< T >(t)))... >, decltype(std::tuple{kblib::apply(f, std::forward< T >(t))...})>
 
template<typename F >
auto kblib::defer (F f)
 
template<typename BinaryOperation >
constexpr auto kblib::flip () -> auto
 Transforms a stateless binary operation into one which takes reversed arguments. More...
 
template<typename BinaryOperation >
constexpr auto kblib::flip (BinaryOperation op) -> auto
 Transforms a binary operation into one which takes reversed arguments. More...
 
template<typename T , std::size_t N>
constexpr auto kblib::is_consecutive (const T(&array)[N]) -> enable_if_t< std::is_integral< T >::value, bool >
 
constexpr auto kblib::filg2 (const std::bitset< std::numeric_limits< std::uintmax_t >::digits > val) noexcept -> int
 Floored integer binary logarithm. Returns floor(lb(val)). More...
 
template<typename T >
auto kblib::safe_auto (T &&in) -> T
 Safely propagate an xvalue or lvalue without dangling references. More...
 
template<typename T >
auto kblib::safe_auto (T &in) -> T &
 Safely propagate an xvalue or lvalue without dangling references. More...
 
template<typename LeftContainer , typename RightContainer >
auto kblib::arraycat (LeftContainer A, RightContainer &&B) noexcept(noexcept(A.insert(A.end(), B.begin(), B.end())) and std::is_nothrow_move_constructible< LeftContainer >::value) -> LeftContainer
 Concatenate two dynamic containers together. More...
 
template<typename T >
constexpr auto kblib::a (const std::initializer_list< T > &a) -> auto
 Index an array literal without naming its type. More...
 

Variables

template<typename... Ts>
constexpr bool kblib::any_void = (std::is_void_v<Ts> or ...)
 

Detailed Description

Provides general utilities which do not fit in any more specific header.

Author
killerbee
Date
2019-2021

Definition in file simple.h.

Macro Definition Documentation

◆ KBLIB_DEBUG_LOG_RANGES

#define KBLIB_DEBUG_LOG_RANGES   0

Definition at line 45 of file simple.h.