kblib 0.2.3
General utilities library for modern C++
|
The main namespace in which all entities from kblib are defined. More...
Namespaces | |
namespace | asserts |
namespace | best_lcgs |
namespace | common_lcgs |
namespace | detail |
The namespace used for implementation details within kblib. | |
namespace | detail_algorithm |
namespace | detail_bits |
namespace | detail_convert |
namespace | detail_cry |
namespace | detail_direct_map |
namespace | detail_enumerate |
namespace | detail_hash |
namespace | detail_io |
namespace | detail_iterators |
namespace | detail_memory |
namespace | detail_poly |
Implementation details for poly_obj. | |
namespace | detail_simple |
namespace | detail_sort |
namespace | detail_units |
namespace | 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 | fnv |
namespace | icu_str_ops |
namespace | lcgs |
namespace | literals |
namespace | multi_impl |
namespace | nums |
Typedefs | |
template<class T , class = std::enable_if_t<std::is_pointer<T>::value>> | |
using | owner = T |
template<bool B, typename T = void> | |
using | enable_if_t = typename std::enable_if< B, T >::type |
template<typename T > | |
using | decay_t = typename std::decay< T >::type |
template<typename T > | |
using | remove_cvref_t = typename std::remove_reference< typename std::remove_cv< T >::type >::type |
template<bool v> | |
using | bool_constant = std::integral_constant< bool, v > |
template<typename... Ts> | |
using | meta_type_t = typename meta_type< Ts... >::type |
template<bool b> | |
using | void_if_t = typename void_if< b >::type |
template<typename T > | |
using | metafunction_value_t = std::integral_constant< decltype(T::value), T::value > |
template<bool V, typename T > | |
using | return_assert_t = typename return_assert< V, T >::type |
template<typename N > | |
using | safe_signed_t = typename safe_signed< N >::type |
template<typename C , typename V > | |
using | copy_const_t = typename copy_const< C, V >::type |
template<typename T > | |
using | value_detected_t = typename value_detected< T >::type |
template<typename T > | |
using | key_detected_t = typename key_detected< T >::type |
template<typename T > | |
using | mapped_detected_t = typename mapped_detected< T >::type |
template<typename T > | |
using | hash_detected_t = typename hash_detected< T >::type |
template<typename Container > | |
using | value_type_linear_t = typename value_type_linear< Container >::type |
template<typename Container > | |
using | key_type_setlike_t = typename key_type_setlike< Container >::type |
template<typename Key > | |
using | FNV32_hash = FNV_hash< Key, std::uint32_t > |
template<typename Key , typename Value > | |
using | hash_map = std::unordered_map< Key, Value, FNV_hash<>, std::equal_to<> > |
template<typename Key , typename Value > | |
using | hash_multimap = std::unordered_multimap< Key, Value, FNV_hash<>, std::equal_to<> > |
template<typename T , typename HashInt > | |
using | hash_set = std::unordered_set< T, FNV_hash<>, std::equal_to<> > |
template<typename T , typename HashInt > | |
using | hash_multiset = std::unordered_set< T, FNV_hash<>, std::equal_to<> > |
template<typename Obj > | |
using | move_only_traits = poly_obj_traits< Obj, construct_type::move > |
template<typename Obj > | |
using | no_move_traits = poly_obj_traits< Obj, construct_type::none > |
template<typename UIntType , UIntType a, UIntType c, UIntType b> | |
using | lcg_p2 = std::linear_congruential_engine< UIntType, a, c, ipow2(b)> |
using | rand48 = transform_engine< lcg_p2< std::uint_fast64_t, 25214903917u, 11u, 48u >, shift_mask< std::uint_fast32_t, 16u > > |
using | java_rand = rand48 |
using | glibc_rand0 = transform_engine< lcg_p2< std::uint_fast32_t, 1103515245, 12345, 31u >, shift_mask< std::uint_fast32_t, 0, ipow2(30) - 1 > > |
using | ansic_rand = transform_engine< lcg_p2< std::uint_fast32_t, 1103515245, 12345, 31u >, shift_mask< std::uint_fast32_t, 16, ipow2(14) - 1 > > |
using | knuth_lcg = std::linear_congruential_engine< uint64_t, 6364136223846793005U, 1442695040888963407U, 0U > |
using | lcg32 = lcg_p2< std::uint_fast32_t, 0xa13fc965u, 1u, 32u > |
using | mcg32 = lcg_p2< std::uint_fast32_t, 0x93d765ddu, 0u, 32u > |
using | lcg48 = lcg_p2< std::uint_fast64_t, 0xb67a49a5466du, 1u, 48u > |
using | mcg48 = lcg_p2< std::uint_fast64_t, 0xbdcdbb079f8du, 0u, 48u > |
using | lcg64 = lcg_p2< std::uint_fast64_t, 0xaf251af3b0f025b5u, 1u, 64u > |
using | mcg64 = lcg_p2< std::uint_fast64_t, 0xf1357aea2e62a9c5u, 0u, 64u > |
template<std::uintmax_t I> | |
using | 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 | 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 | uint_smallest_t = typename uint_smallest< I >::type |
template<std::uintmax_t I> | |
using | int_smallest_t = typename int_smallest< I >::type |
template<typename T > | |
using | alias = T |
A simple identity alias for simplifying some compound type declarations, such as function pointers. More... | |
template<typename U , typename T > | |
using | ignore_t = typename ignore< U, T >::type |
An alias for ignore<U, T>::type. More... | |
template<typename T > | |
using | class_of_t = typename class_of< T >::type |
template<typename T > | |
using | member_of_t = typename member_of< T >::type |
template<typename Range > | |
using | iterator_type_for_t = typename iterator_type_for< Range >::type |
template<typename T > | |
using | remove_reference_t = typename std::remove_reference< T >::type |
Abbreviated name for std::remove_reference<T>::type for C++14. More... | |
template<typename Container > | |
using | default_extractor_t = typename std::conditional< extractor_policy_for< Container >::value==extractor_policy::random_access, indexer_extractor< Container >, iterator_extractor< Container > >::type |
Enumerations | |
enum class | construct_type : unsigned { none = 0 , copy_only = 1 , move = 2 , both = 3 , throw_move = 4 , both_throw = 5 } |
enum class | endian { unknown , little , big , weird } |
enum class | extractor_policy { forward_iteration , random_access } |
Functions | |
template<typename Callable > | |
constexpr auto | repeat (std::size_t N, Callable func) noexcept(noexcept(func())) -> return_assert_t< is_invocable< Callable >::value, void > |
Invoke a function N times. More... | |
template<typename Container , typename Elem > | |
constexpr auto | erase (Container &c, const Elem &val) noexcept(noexcept(c.erase(std::remove(c.begin(), c.end(), val), c.end()))) -> void |
Abbreviation of the erase-remove idiom as a free function. More... | |
template<typename Container , typename UnaryPredicate > | |
constexpr auto | erase_if (Container &c, UnaryPredicate p) noexcept(noexcept(c.erase(std::remove_if(c.begin(), c.end(), std::ref(p)), c.end()))) -> void |
Abbreviation of the erase-remove idiom as a free function. More... | |
template<typename Obj > | |
constexpr auto | equals (const Obj &a, const Obj &b) noexcept(noexcept(a< b)) -> bool |
Synthesize an equivalence relation from <. More... | |
template<typename Obj , typename Compare > | |
constexpr auto | equals (const Obj &a, const Obj &b, Compare comp) noexcept(noexcept(comp(a, b))) -> bool |
Synthesize an equivalence relation from comp. More... | |
template<typename InputIt , typename T > | |
constexpr auto | accumulate (InputIt first, InputIt last, T init) -> T |
A constexpr version of std::accumulate. More... | |
template<class InputIt , class T , class BinaryOperation > | |
constexpr auto | accumulate (InputIt first, InputIt last, T init, BinaryOperation op) -> T |
A constexpr version of std::accumulate. More... | |
template<typename InputIt > | |
constexpr auto | sum (InputIt first, InputIt last) -> std::decay_t< decltype(*first)> |
Sum a range. More... | |
template<typename InputIt , typename BinaryOperation > | |
constexpr auto | sum (InputIt first, InputIt last, BinaryOperation op) -> std::decay_t< decltype(*first)> |
Fold a range over an operation. More... | |
template<typename Range > | |
constexpr auto | sum (Range &&r) -> auto |
Sum a range. More... | |
template<typename InputIt , typename EndIt , typename OutputIt , typename T , typename BinaryAccumulation , typename UnaryTransform > | |
constexpr auto | transform_exclusive_scan (InputIt first, EndIt last, OutputIt d_first, T init, BinaryAccumulation accum, UnaryTransform proj) -> OutputIt |
template<typename ForwardIt , typename EndIt , typename Elem > | |
constexpr auto | find (ForwardIt begin, EndIt end, const Elem &value) noexcept(noexcept(*begin==value)) -> ForwardIt |
Finds a value in range [begin, end). If not found, returns end. It also allows for a sentinel end iterator. More... | |
template<typename ForwardIt , typename EndIt , typename Elem , typename Comp > | |
constexpr auto | find (ForwardIt begin, EndIt end, const Elem &value, Comp &&comp) noexcept(noexcept(comp(*begin, value))) -> ForwardIt |
Finds a value in range [begin, end). If not found, returns end. It also allows for a sentinel end iterator. More... | |
template<typename ForwardIt , typename EndIt , typename UnaryPredicate > | |
constexpr auto | find_if (ForwardIt begin, EndIt end, UnaryPredicate &&pred) noexcept(noexcept(kblib::invoke(pred, *begin))) -> ForwardIt |
Finds the first value in range [begin, end) for which pred returns true. If not found, returns end. It also allows for a sentinel end iterator. More... | |
template<typename ForwardIt , typename EndIt , typename UnaryPredicate > | |
constexpr auto | find_if_not (ForwardIt begin, EndIt end, UnaryPredicate &&pred) noexcept(noexcept(kblib::invoke(pred, *begin))) -> ForwardIt |
Finds the first value in range [begin, end) for which pred returns false. If not found, returns end. It also allows for a sentinel end iterator. More... | |
template<typename ForwardIt , typename EndIt , typename Elem > | |
constexpr auto | find_last (ForwardIt begin, EndIt end, const Elem &value) noexcept(noexcept(*begin==value)) -> ForwardIt |
Searches a range for the last occurence of a match, and returns an iterator to it. It also allows for a sentinel end iterator. More... | |
template<typename ForwardIt , typename EndIt , typename UnaryPredicate > | |
constexpr auto | find_last_if (ForwardIt begin, EndIt end, UnaryPredicate pred) noexcept(noexcept(kblib::invoke(pred, *begin))) -> ForwardIt |
Searches a range for the last element on which a predicate returns true. It also allows for a sentinel end iterator. More... | |
template<typename ForwardIt , typename EndIt , typename UnaryPredicate > | |
constexpr auto | find_last_if_not (ForwardIt begin, EndIt end, UnaryPredicate pred) noexcept(noexcept(kblib::invoke(pred, *begin))) -> ForwardIt |
Searches a range for the last element on which a predicate returns false. It also allows for a sentinel end iterator. More... | |
template<typename ForwardIt , typename EndIt , typename Elem > | |
constexpr auto | find_in (ForwardIt begin, EndIt end, const Elem &value) noexcept(noexcept(*begin==value)) -> size_t |
Find the offset of the first ocurrence of v in a range from the beginning. It also allows for a sentinel end iterator. More... | |
template<typename ForwardIt , typename EndIt , typename UnaryPredicate > | |
constexpr auto | find_in_if (ForwardIt begin, EndIt end, UnaryPredicate pred) noexcept(noexcept(kblib::invoke(pred, *begin))) -> size_t |
Find the offset of the first element for which p returns true. It also allows for a sentinel end iterator. More... | |
template<typename ForwardIt , typename EndIt , typename UnaryPredicate > | |
constexpr auto | find_in_if_not (ForwardIt begin, EndIt end, UnaryPredicate pred) noexcept(noexcept(kblib::invoke(pred, *begin))) -> size_t |
Find the offset of the first element for which p returns false. It also allows for a sentinel end iterator. More... | |
template<typename ForwardIt , typename EndIt , typename Elem > | |
constexpr auto | find_last_in (ForwardIt begin, EndIt end, const Elem &value) noexcept(noexcept(*begin==value)) -> size_t |
Find the offset of the last ocurrence of v in a range from the beginning. It also allows for a sentinel end iterator. More... | |
template<typename ForwardIt , typename EndIt , typename UnaryPredicate > | |
constexpr auto | find_last_in_if (ForwardIt begin, EndIt end, UnaryPredicate pred) noexcept(noexcept(kblib::invoke(pred, *begin))) -> size_t |
template<typename ForwardIt , typename EndIt , typename UnaryPredicate > | |
constexpr auto | find_last_in_if_not (ForwardIt begin, EndIt end, UnaryPredicate pred) noexcept(noexcept(kblib::invoke(pred, *begin))) -> size_t |
Find the offset of the last element for which p returns false. It also allows for a sentinel end iterator. More... | |
template<typename Container , typename T > | |
constexpr auto | find_in (const Container &c, const T &value) noexcept(noexcept(*std::declval< iterator_type_for_t< const Container > & >()==value)) -> size_t |
Find the first element in c equal to v and return the position. More... | |
template<typename Container , typename UnaryPredicate > | |
constexpr auto | find_in_if (const Container &c, UnaryPredicate pred) noexcept(noexcept(kblib::invoke(pred, *std::declval< iterator_type_for_t< const Container > & >()))) -> size_t |
Find the first element in c for which p returns true and return the position. More... | |
template<typename Container , typename UnaryPredicate > | |
constexpr auto | find_in_if_not (const Container &c, UnaryPredicate pred) noexcept(noexcept(kblib::invoke(pred, *std::declval< iterator_type_for_t< const Container > & >()))) -> size_t |
Find the first element in c for which p returns false and return the position. More... | |
template<typename Container , typename T > | |
constexpr auto | find_last_in (const Container &c, const T &value) noexcept(noexcept(*std::declval< iterator_type_for_t< const Container > & >()==value)) -> size_t |
Find the last element in c equal to v and return the position. More... | |
template<typename Container , typename UnaryPredicate > | |
constexpr auto | find_last_in_if (const Container &c, UnaryPredicate pred) noexcept(noexcept(kblib::invoke(pred, *std::declval< iterator_type_for_t< const Container > & >()))) -> size_t |
Find the last element in c for which p returns true and return the position. More... | |
template<typename Container , typename UnaryPredicate > | |
constexpr auto | find_last_in_if_not (const Container &c, UnaryPredicate pred) noexcept(noexcept(kblib::invoke(pred, *std::declval< iterator_type_for_t< const Container > & >()))) -> size_t |
Find the last element in c for which p returns true and return the position. More... | |
template<typename InputIt1 , typename EndIt1 , typename InputIt2 , typename BinaryPredicate = std::equal_to<>> | |
constexpr auto | find_match (InputIt1 begin1, EndIt1 end1, InputIt2 begin2, BinaryPredicate cmp) -> enable_if_t< is_input_iterator< InputIt1 >::value and is_input_iterator< InputIt2 >::value and is_invocable< BinaryPredicate, decltype(*begin1), decltype(*begin2)>::value, std::pair< InputIt1, InputIt2 > > |
template<typename InputIt1 , typename EndIt1 , typename InputIt2 , typename EndIt2 , typename BinaryPredicate = std::equal_to<>> | |
constexpr auto | find_match (InputIt1 begin1, EndIt1 end1, InputIt2 begin2, EndIt2 end2, BinaryPredicate cmp) -> enable_if_t< is_input_iterator< InputIt1 >::value and is_input_iterator< InputIt2 >::value and is_invocable< BinaryPredicate, decltype(*begin1), decltype(*begin2)>::value, std::pair< InputIt1, InputIt2 > > |
template<typename InputIt1 , typename EndIt1 , typename InputIt2 , typename EndIt2 , typename BinaryPred > | |
constexpr auto | starts_with (InputIt1 begin1, EndIt1 end1, InputIt2 begin2, EndIt2 end2, BinaryPred pred) -> enable_if_t<(is_input_iterator_v< InputIt1 > and is_input_iterator_v< InputIt2 >) and not(is_random_access_iterator_v< InputIt1 > and is_random_access_iterator_v< InputIt2 >), bool > |
Checks if a given range starts with a particular subrange. More... | |
template<typename RandomAccessIt1 , typename RandomAccessIt2 , typename BinaryPred = std::equal_to<>> | |
constexpr auto | starts_with (RandomAccessIt1 begin1, RandomAccessIt1 end1, RandomAccessIt2 begin2, RandomAccessIt2 end2, BinaryPred pred={}) -> enable_if_t< is_random_access_iterator_v< RandomAccessIt1 > and is_random_access_iterator_v< RandomAccessIt2 >, bool > |
Checks if a given range starts with a particular subrange. More... | |
template<typename BidirIt1 , typename BidirIt2 , typename BinaryPred = std::equal_to<>> | |
constexpr auto | ends_with (BidirIt1 begin1, BidirIt1 end1, BidirIt2 begin2, BidirIt2 end2, BinaryPred pred={}) -> enable_if_t<(is_bidirectional_iterator_v< BidirIt1 > and is_bidirectional_iterator_v< BidirIt2 >) and not(is_random_access_iterator_v< BidirIt1 > and is_random_access_iterator_v< BidirIt2 >), bool > |
Checks if a given range ends with a particular subrange. More... | |
template<typename RandomAccessIt1 , typename RandomAccessIt2 , typename BinaryPred = std::equal_to<>> | |
constexpr auto | ends_with (RandomAccessIt1 begin1, RandomAccessIt1 end1, RandomAccessIt2 begin2, RandomAccessIt2 end2, BinaryPred pred={}) -> enable_if_t< is_random_access_iterator_v< RandomAccessIt1 > and is_random_access_iterator_v< RandomAccessIt2 >, bool > |
Checks if a given range ends with a particular subrange. More... | |
template<typename InputIt , typename EndIt , typename T , typename UnaryTransform > | |
constexpr auto | first_result (InputIt begin, EndIt end, T def, UnaryTransform op) -> enable_if_t< is_input_iterator< InputIt >::value, std::decay_t< decltype(op(*begin))> > |
template<typename InputIt1 , typename EndIt1 , typename InputIt2 , typename T , typename BinaryTransform > | |
constexpr auto | first_result (InputIt1 begin1, EndIt1 end1, InputIt2 begin2, T def, BinaryTransform op) -> enable_if_t< is_input_iterator< InputIt1 >::value and is_input_iterator< InputIt2 >::value, std::decay_t< decltype(op(*begin1, *begin2))> > |
template<typename InputIt1 , typename EndIt1 , typename InputIt2 , typename EndIt2 , typename T , typename BinaryTransform > | |
constexpr auto | first_result (InputIt1 begin1, EndIt1 end1, InputIt2 begin2, EndIt2 end2, T def, BinaryTransform op) -> enable_if_t< is_input_iterator< InputIt1 >::value and is_input_iterator< InputIt2 >::value, std::decay_t< decltype(op(*begin1, *begin2))> > |
template<typename InputIt , typename EndIt , typename T , typename UnaryTransform , typename UnaryPredicate > | |
constexpr auto | first_result_if (InputIt begin, EndIt end, T def, UnaryTransform op, UnaryPredicate ch) -> enable_if_t< is_input_iterator< InputIt >::value, decltype(op(*begin))> |
template<typename InputIt1 , typename EndIt1 , typename InputIt2 , typename T , typename BinaryTransform , typename BinaryPredicate > | |
constexpr auto | first_result_if (InputIt1 begin1, EndIt1 end1, InputIt2 begin2, T def, BinaryTransform op, BinaryPredicate ch) -> enable_if_t< is_input_iterator< InputIt1 >::value and is_input_iterator< InputIt2 >::value, decltype(op(*begin1, *begin2))> |
template<typename InputIt1 , typename EndIt1 , typename InputIt2 , typename EndIt2 , typename T , typename BinaryTransform , typename BinaryPredicate > | |
constexpr auto | first_result_if (InputIt1 begin1, EndIt1 end1, InputIt2 begin2, EndIt2 end2, T def, BinaryTransform op, BinaryPredicate ch) -> enable_if_t< is_input_iterator< InputIt1 >::value and is_input_iterator< InputIt2 >::value, decltype(op(*begin1, *begin2))> |
template<typename InputIt , typename EndIt , typename T , typename UnaryTransform > | |
constexpr auto | first_result_opt (InputIt begin, EndIt end, T def, UnaryTransform op) -> enable_if_t< is_input_iterator< InputIt >::value, std::decay_t< decltype(op(*begin))> > |
template<typename InputIt1 , typename EndIt1 , typename InputIt2 , typename T , typename BinaryTransform > | |
constexpr auto | first_result_opt (InputIt1 begin1, EndIt1 end1, InputIt2 begin2, T def, BinaryTransform op) -> enable_if_t< is_input_iterator< InputIt1 >::value and is_input_iterator< InputIt2 >::value, std::decay_t< decltype(op(*begin1, *begin2))> > |
template<typename InputIt1 , typename EndIt1 , typename InputIt2 , typename EndIt2 , typename T , typename BinaryTransform > | |
constexpr auto | first_result_opt (InputIt1 begin1, EndIt1 end1, InputIt2 begin2, EndIt2 end2, T def, BinaryTransform op) -> enable_if_t< is_input_iterator< InputIt1 >::value and is_input_iterator< InputIt2 >::value, std::decay_t< decltype(op(*begin1, *begin2))> > |
template<typename InputIt , typename UnaryPredicate > | |
constexpr auto | all_of (InputIt begin, InputIt end, UnaryPredicate pred) -> enable_if_t< is_input_iterator< InputIt >::value, bool > |
Determine if pred is true for every element of the range. More... | |
template<typename Range , typename UnaryPredicate > | |
constexpr auto | all_of (Range &&rng, UnaryPredicate pred) -> enable_if_t< is_iterable< Range >::value, bool > |
Determine if pred is true for every element of the range. More... | |
template<typename InputIt , typename UnaryPredicate > | |
constexpr auto | none_of (InputIt begin, InputIt end, UnaryPredicate pred) -> enable_if_t< is_input_iterator< InputIt >::value, bool > |
Determine if pred is false for every element of the range. More... | |
template<typename Range , typename UnaryPredicate > | |
constexpr auto | none_of (Range &&rng, UnaryPredicate pred) -> enable_if_t< is_iterable< Range >::value, bool > |
Determine if pred is true for every element of the range. More... | |
template<typename InputIt , typename UnaryPredicate > | |
constexpr auto | any_of (InputIt begin, InputIt end, UnaryPredicate pred) -> enable_if_t< is_input_iterator< InputIt >::value, bool > |
Determine if pred is true for at least one element of the range. More... | |
template<typename Range , typename UnaryPredicate > | |
constexpr auto | any_of (Range &&rng, UnaryPredicate pred) -> enable_if_t< is_iterable< Range >::value, bool > |
Determine if pred is true for every element of the range. More... | |
template<typename InputIt , typename Value > | |
constexpr auto | contains (InputIt begin, InputIt end, const Value &val) noexcept(noexcept(*begin==val)) -> enable_if_t< is_input_iterator< InputIt >::value, bool > |
Determine if a range contains a value. More... | |
template<typename Set , typename Value > | |
constexpr auto | contains (const Set &set, const Value &val) noexcept(noexcept(*std::declval< iterator_type_for_t< const Set > & >()==val)) -> enable_if_t< is_iterable< Set >::value, bool > |
Determine if a range contains a value. More... | |
template<typename InputIt1 , typename InputIt2 > | |
constexpr auto | contains_any (InputIt1 begin, InputIt1 end, InputIt2 n_begin, InputIt2 n_end) -> enable_if_t< is_input_iterator< InputIt1 >::value and is_input_iterator< InputIt2 >::value, bool > |
template<typename InputIt , typename Range2 > | |
constexpr auto | contains_any (InputIt begin, InputIt end, Range2 &&needle) -> enable_if_t< is_input_iterator< InputIt >::value and is_iterable< Range2 >::value, bool > |
template<typename Range1 , typename Range2 > | |
constexpr auto | contains_any (Range1 &&haystack, Range2 &&needle) -> enable_if_t< is_iterable< Range1 >::value and is_iterable< Range2 >::value, bool > |
template<typename ForwardIt , typename EndIt , typename Compare = std::less<>> | |
constexpr auto | max_element (ForwardIt first, EndIt last, Compare comp={}) -> ForwardIt |
template<typename SequenceContainer , typename Comp = std::less<>, typename It , enable_if_t< is_linear_container_v< SequenceContainer >, int > = 0> | |
constexpr auto | get_max_n_old (It first, It last, std::size_t count, Comp cmp={}) -> SequenceContainer |
Returns a container of the greatest count elements according to cmp of the range [first, last), in arbitrary order. This overload works for linear containers. More... | |
template<typename SequenceContainer , typename Comp = std::less<>, typename It , enable_if_t< is_linear_container_v< SequenceContainer >, int > = 0> | |
constexpr auto | get_max_n (It first, It last, std::size_t count, Comp cmp={}) -> SequenceContainer |
Returns a container of the greatest count elements according to cmp of the range [first, last), in descending order. This overload works for linear containers. More... | |
template<typename Comp = std::less<>, typename InputIt , typename OutputIt , typename Elem = typename std::iterator_traits<InputIt>::value_type> | |
constexpr auto | get_max_n (InputIt first, InputIt last, OutputIt d_begin, std::size_t count, Comp cmp={}) -> return_assert_t< is_output_iterator_for< OutputIt, Elem >::value, OutputIt > |
Copies the count greatest elements according to cmp of the range [first, last) to the range beginning at d_begin. More... | |
template<typename ForwardIt , typename EndIt , typename ForwardIt2 , typename BinaryFunction > | |
constexpr auto | for_each (ForwardIt first, EndIt last, ForwardIt2 second, BinaryFunction f) -> BinaryFunction |
Applies a binary operation to each pair of corresponding elements in two input ranges. It also allows for a sentinel end iterator. More... | |
template<typename ForwardIt , typename ForwardIt2 , typename Size , typename BinaryFunction > | |
constexpr auto | for_each_n (ForwardIt first, Size n, ForwardIt2 second, BinaryFunction f) -> std::pair< ForwardIt, ForwardIt2 > |
Applies a binary operation to each pair of corresponding elements in two input ranges. More... | |
template<typename InputIt , typename EndIt , typename OutputIt > | |
constexpr auto | copy (InputIt first, EndIt last, OutputIt out) -> OutputIt |
Copies all elements of [first , last ) to out. It also allows for a sentinel end iterator. More... | |
template<typename InputIt , typename EndIt , typename OutputIt , typename UnaryPredicate > | |
constexpr auto | copy_if (InputIt first, EndIt last, OutputIt out, UnaryPredicate pred) -> OutputIt |
Copies those elements of [first , last ) which satisfy pred to out. It also allows for a sentinel end iterator. More... | |
template<typename InputIt , typename Size , typename OutputIt > | |
constexpr auto | copy_n (InputIt first, Size count, OutputIt out) -> OutputIt |
Copies all elements of [first , std::advance(first, n) ) to out. More... | |
template<typename InputIt , typename Size , typename OutputIt , typename UnaryPredicate > | |
constexpr auto | copy_n_if (InputIt first, Size count, OutputIt out, UnaryPredicate pred) -> OutputIt |
Copies those elements of [first , std::advance(first, n) ) which satisfy pred to out. More... | |
template<typename InputIt , typename EndIt , typename OutputIt , typename UnaryPredicate , typename T > | |
constexpr auto | replace_copy_if (InputIt first, EndIt last, OutputIt out, UnaryPredicate pred, const T &new_value) -> OutputIt |
Copies an input range, but every element for which pred is true is replaced by new_value. It also allows for a sentinel end iterator. More... | |
template<typename InputIt , typename Size , typename OutputIt , typename UnaryPredicate , typename T > | |
constexpr auto | replace_copy_n_if (InputIt first, Size count, OutputIt out, UnaryPredicate pred, const T &new_value) -> OutputIt |
Copies an input range, but every element for which pred is true is replaced by new_value. More... | |
template<typename ForwardIt1 , typename ForwardIt2 , typename ForwardIt3 , typename OutputIt , typename BinaryPredicate = std::equal_to<>> | |
constexpr auto | search_replace_copy (ForwardIt1 h_begin, ForwardIt1 h_end, ForwardIt2 n_begin, ForwardIt2 n_end, ForwardIt3 r_begin, ForwardIt3 r_end, OutputIt d_begin, BinaryPredicate Compare={}) -> OutputIt |
template<typename Haystack , typename Needle , typename Replacement , typename OutputIt , typename BinaryPredicate = std::equal_to<>> | |
constexpr auto | search_replace_copy (Haystack &&haystack, Needle &&needle, Replacement &&replacement, OutputIt d_begin, BinaryPredicate compare={}) |
template<class ForwardIt > | |
constexpr auto | rotate (ForwardIt first, ForwardIt n_first, ForwardIt last) noexcept(noexcept(swap(*first, *first))) -> ForwardIt |
Rotates the input range. This is just a constexpr-in-C++14 version of std::rotate. More... | |
template<typename OutputIt , typename EndIt , typename Generator > | |
constexpr auto | generate (OutputIt first, EndIt last, Generator g) noexcept(noexcept(*++first=g())) -> OutputIt |
Like std::generate except that it returns the output iterator at the end. It also allows for a sentinel end iterator. More... | |
template<typename OutputIt , typename Size , typename Generator > | |
constexpr auto | generate_n (OutputIt first, Size count, Generator g) noexcept(noexcept(*first++=g())) -> OutputIt |
Like std::generate_n except that it is constexpr. More... | |
template<typename ForwardIt , typename T > | |
constexpr auto | iota (ForwardIt first, ForwardIt last, T value) noexcept(noexcept(*first++=value) and noexcept(++value)) -> void |
template<typename ForwardIt , typename T , typename UnaryOperation > | |
constexpr auto | iota (ForwardIt first, ForwardIt last, T value, UnaryOperation unary_op) noexcept(noexcept(*first++=value) and noexcept(kblib::invoke(unary_op, std::move(value)))) -> void |
template<typename InputIt , typename EndIt , typename... Params> | |
constexpr auto | call_each (InputIt first, EndIt last, Params &&... params) noexcept(noexcept(kblib::invoke(*first++, std::forward< Params >(params)...))) -> InputIt |
template<typename InputIt , typename EndIt , typename OutputIt , typename UnaryOperation > | |
constexpr auto | transform (InputIt first, EndIt last, OutputIt d_first, UnaryOperation unary_op) -> OutputIt |
transform applies the given function to a range and stores the result in another range, beginning at d_first. The unary operation unary_op is applied to the range defined by [first1, last1). It also allows for a sentinel end iterator. More... | |
template<typename InputIt , typename EndIt , typename InputIt2 , typename OutputIt , typename BinaryOperation > | |
constexpr auto | transform (InputIt first, EndIt last, InputIt first2, OutputIt d_first, BinaryOperation binary_op) -> OutputIt |
transform applies the given function to a range and stores the result in another range, beginning at d_first. The unary operation unary_op is applied to the range defined by [first1, last1). It also allows for a sentinel end iterator. More... | |
template<typename InputIt , typename EndIt , typename OutputIt , typename UnaryPredicate , typename UnaryOperation > | |
constexpr auto | transform_if (InputIt first, EndIt last, OutputIt d_first, UnaryPredicate pred, UnaryOperation unary_op) -> OutputIt |
transform applies the given function to a range and stores the result in another range, beginning at d_first. The unary operation unary_op is applied to the range defined by [first1, last1). It also allows for a sentinel end iterator. More... | |
constexpr auto | memswap (unsigned char *A, unsigned char *B, std::size_t size) noexcept -> void |
Swaps memory ranges. More... | |
auto | memswap (void *A, void *B, std::size_t size) noexcept -> void |
Swaps memory ranges. More... | |
template<std::size_t I, typename... Types> | |
auto | get (punner< Types... > &p) noexcept -> decltype(auto) |
template<std::size_t I, typename... Types> | |
auto | get (const punner< Types... > &p) noexcept -> decltype(auto) |
template<std::size_t I, typename... Types> | |
auto | get (punner< Types... > &&p) noexcept -> decltype(auto) |
template<std::size_t I, typename... Types> | |
auto | get (const punner< Types... > &&p) noexcept -> decltype(auto) |
template<typename Container , typename InputIt , typename UnaryFunction > | |
auto | build (InputIt first, InputIt last, UnaryFunction f, typename Container::allocator_type allocator=typename Container::allocator_type{}) -> Container |
Constructs a container by applying a UnaryFunction to every element of an input range. More... | |
template<typename Container , typename InputIt , typename InputIt2 , typename BinaryFunction > | |
auto | build (InputIt first, InputIt last, InputIt2 first2, BinaryFunction f, typename Container::allocator_type allocator=typename Container::allocator_type{}) -> Container |
Constructs a container by applying a BinaryFunction to every pair of elements in the input ranges. More... | |
template<typename Array , typename InputIt , typename UnaryFunction , enable_if_t< not is_resizable_v< Array >, int > = 0> | |
auto | build (InputIt first, InputIt last, UnaryFunction f) -> Array |
Constructs an array-like container by applying a UnaryFunction to every element of an input range. More... | |
template<typename Array , typename InputIt , typename InputIt2 , typename BinaryFunction , enable_if_t< not is_resizable_v< Array >, int > = 0> | |
auto | build (InputIt first, InputIt last, InputIt2 first2, BinaryFunction f) -> Array |
Constructs an array-like container by applying a BinaryFunction to every pair of elements in the input ranges. More... | |
template<typename Container , typename Functor > | |
auto | build (Functor f, size_t size, typename Container::allocator_type allocator=typename Container::allocator_type{}) -> Container |
Constructs a container with elements initialized by repeatedly calling a generating function. More... | |
template<typename Array , typename Functor , enable_if_t< not is_resizable_v< Array >, int > = 0> | |
auto | build (Functor f, size_t size=std::tuple_size< Array >::value) -> Array |
Constructs an array-like container with elements initialized by repeatedly calling a generating function. More... | |
template<typename Container , typename InputIt , typename UnaryFunction > | |
auto | build_dy (InputIt first, InputIt last, UnaryFunction f) -> Container |
Constructs a container by applying a UnaryFunction to every element of an input range. Exactly like build , but for resizable non-AllocatorAware Containers (which are hard to detect automatically). More... | |
template<typename Container , typename InputIt , typename InputIt2 , typename BinaryFunction > | |
auto | build_dy (InputIt first, InputIt last, InputIt2 first2, BinaryFunction f) -> Container |
Constructs a container by applying a BinaryFunction to every pair of elements in the input ranges. Exactly like build , but for resizable non-AllocatorAware Containers (which are hard to detect automatically). More... | |
template<typename Container , typename Functor > | |
auto | build_dy (Functor f, size_t size) -> Container |
Constructs a container with elements initialized by repeatedly calling a generating function. Exactly like build , but for resizable non-AllocatorAware Containers (which are hard to detect automatically). More... | |
template<typename Container , typename Range , typename UnaryFunction , enable_if_t< is_resizable_v< Container >, int > = 0> | |
auto | build_dy (Range &&r, UnaryFunction f) -> Container |
template<typename Container , typename... Args> | |
constexpr auto | buildiota (Args &&... args) -> auto |
Builds a container of increasing values. More... | |
template<typename Container , typename InputIt > | |
auto | build_copy (InputIt first, InputIt last, typename Container::allocator_type allocator=typename Container::allocator_type{}) -> Container |
template<typename Container , typename Range , enable_if_t< is_resizable_v< Container >, int > = 0> | |
auto | build_copy (Range &&r) -> Container |
template<typename Container , typename Range > | |
auto | build_copy (Range &&r, typename Container::allocator_type allocator=typename Container::allocator_type{}) -> Container |
template<typename Container , typename InputIt , enable_if_t< not is_resizable_v< Container >, int > = 0> | |
constexpr auto | build_copy (InputIt first, InputIt last) -> Container |
template<typename Container , typename Range , enable_if_t< not is_resizable_v< Container >, int > = 0> | |
constexpr auto | build_copy (Range &&r) -> Container |
template<typename Container , typename InputIt , enable_if_t< not is_resizable_v< Container >, int > = 0> | |
auto | build_copy (InputIt first, InputIt last, std::size_t size) -> Container |
template<typename Container , typename Range , enable_if_t< not is_resizable_v< Container >, int > = 0> | |
auto | build_copy (Range &&r, std::size_t size) -> Container |
template<typename Container , typename InputIt , typename Predicate > | |
auto | build_copy_if (InputIt first, InputIt last, Predicate f, typename Container::allocator_type allocator=typename Container::allocator_type{}) -> Container |
template<typename Container , typename InputIt , typename Size > | |
auto | build_copy_n (InputIt first, Size count, typename Container::allocator_type allocator=typename Container::allocator_type{}) -> Container |
template<typename Container , typename InputIt , typename Size , typename Predicate > | |
auto | build_copy_n_if (InputIt first, Size count, Predicate f, typename Container::allocator_type allocator=typename Container::allocator_type{}) -> Container |
template<typename C > | |
constexpr auto | pop (C &s) -> typename C::value_type |
template<class C , typename K , typename V > | |
constexpr auto | get_or (const C &m, const K &key, const V &defval) -> typename C::mapped_type |
template<typename Map , typename Key > | |
constexpr auto | try_get (Map &map, Key &&key) -> copy_const_t< Map, typename Map::mapped_type > * |
template<typename M , typename K > | |
constexpr auto | get_check (M &&m, const K &key) noexcept(noexcept(m.find(key) !=m.end())) -> exists_t< decltype(m.find(key))> |
template<typename V > | |
auto | force_shrink_to_fit (V &vec) -> void |
std::vector::shrink_to_fit is non-binding, which means that there is no guaranteed way to shrink a vector via its API. This function is a roundabout way of doing that without relying on the sanity of the implementation (except that it assumes that a vector won't significantly over-allocate on sized construction). More... | |
template<typename Container , typename Range > | |
constexpr auto | construct_from_range (Range &&r) -> Container |
Allows for constructing a container of a specified type from a range object. Copy elision means that this does not result in any extra copies. More... | |
template<int base, typename Int > | |
auto | to_string (Int num) -> std::string |
template<typename Int > | |
auto | to_string (Int num, int base) -> std::string |
template<typename Result > | |
constexpr auto | parse_integer (const char *begin, const char *end, int base=0) -> Result |
template<typename Result , std::size_t N> | |
constexpr auto | parse_integer (const char(&in)[N], int base=0) -> Result |
template<typename Result > | |
constexpr auto | parse_integer (const std::string &in, int base=0) -> Result |
template<typename Result > | |
constexpr auto | parse_integer (std::string_view in, int base=0) -> Result |
template<char... Cs> | |
constexpr auto | operator""_c () |
template<char... Cs> | |
constexpr auto | operator""_cu () |
template<typename E , typename = typename std::enable_if<std::is_enum<E>::value>::type> | |
constexpr auto | etoi (E e) -> auto |
template<int maxBufLen = 4096, typename clock , typename duration > | |
auto | time_to_str (std::chrono::time_point< clock, duration > &tp, const std::string &fmt="%F %T") -> std::string |
template<typename Rep , typename Ratio , enable_if_t< detail_units::is_si_ratio< typename Ratio::type >::value > * = 0> | |
auto | duration_to_str (std::chrono::duration< Rep, Ratio > &d) -> std::string |
template<typename Rep > | |
auto | duration_to_str (std::chrono::duration< Rep, std::ratio< 60 > > d) -> std::string |
template<typename Rep > | |
auto | duration_to_str (std::chrono::duration< Rep, std::ratio< 3600 > > d) -> std::string |
template<typename string > | |
auto | url_encode (const string &value) -> std::string |
template<typename string > | |
auto | html_encode (const string &data) -> std::string |
auto | escapify (char c) -> std::string |
template<typename string > | |
auto | escapify (const string &value) -> std::string |
template<typename string > | |
auto | calculate_translated_index (string &&value, const char *p) -> std::ptrdiff_t |
auto | calculate_translated_index (const char *value, const char *p) -> std::ptrdiff_t |
template<typename character , enable_if_t< is_character_v< character > > * = nullptr> | |
auto | quoted (character c) -> std::string |
template<typename string , enable_if_t< not is_character_v< string > > * = nullptr> | |
auto | quoted (string &&in) -> std::string |
template<typename T > | |
auto | fromStr (const std::string &val, const char *type=typeid(T).name()) -> T |
template<> | |
auto | fromStr (const std::string &val, const char *) -> std::string |
template<> | |
auto | fromStr (const std::string &val, const char *type) -> bool |
template<typename T > | |
auto | fromStr (std::string &&val, const char *type=typeid(T).name()) -> T |
template<> | |
auto | fromStr (std::string &&val, const char *) -> std::string |
template<> | |
auto | fromStr (std::string &&val, const char *type) -> bool |
template<> | |
auto | fromStr (const std::string &val, const char *) -> std::string_view |
template<> | |
auto | fromStr (std::string &&, const char *) -> std::string_view=delete |
template<typename T > | |
auto | fromStr (std::string_view val, const char *type=typeid(T).name()) -> T |
template<> | |
auto | fromStr (std::string_view val, const char *) -> std::string_view |
template<> | |
auto | fromStr (std::string_view val, const char *) -> std::string |
template<> | |
auto | fromStr (std::string_view val, const char *type) -> bool |
template<typename To , std::size_t N> | |
auto | fromStr (const char(&val)[N], const char *type=typeid(To).name()) -> To |
template<typename To , typename _ > | |
auto | fromStr (const char *val, const char *type=typeid(To).name(), _=0) -> To |
template<typename T > | |
auto | toStr (T val) -> std::string |
auto | toStr (std::string val) -> std::string |
template<typename To , typename From > | |
auto | lexical_cast (const From &val, const char *type=typeid(To).name()) -> To |
template<typename Range > | |
auto | cry_enumerate (Range &&range) -> auto |
template<typename Range > | |
constexpr auto | enumerate (Range &&r) -> enumerate_t< Range && > |
Allow access to indexes while using range-based for loops. Safe to use with rvalues. More... | |
template<typename It , typename EIt > | |
constexpr auto | enumerate (It begin, EIt end) -> enumerate_t< It, EIt > |
Allow access to indexes while using range-based for loops. More... | |
template<typename F , typename... Args> | |
constexpr auto | invoke (F &&f, Args &&... args) noexcept(noexcept(detail::do_invoke(std::forward< F >(f), std::forward< Args >(args)...))) -> decltype(auto) |
template<typename F , typename Arg > | |
constexpr auto | 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 | to_unique (owner< T * > p) -> std::unique_ptr< T > |
template<typename T , typename D > | |
auto | to_unique (owner< T * > p, D &&d) -> std::unique_ptr< T, D > |
template<typename I > | |
constexpr auto | to_unsigned (I x) -> std::make_unsigned_t< I > |
Cast integral argument to corresponding unsigned type. More... | |
template<typename I > | |
constexpr auto | to_signed (I x) -> std::make_signed_t< I > |
Cast integral argument to corresponding signed type. More... | |
template<typename A , typename F > | |
constexpr auto | 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 T , typename U = T> | |
constexpr auto | exchange (T &obj, U &&new_value) -> T |
template<typename N > | |
constexpr auto | signed_promote (N x) noexcept -> safe_signed_t< N > |
template<class InputIt1 , class InputIt2 > | |
constexpr auto | 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 | 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 | 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 | 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 | 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 | equal (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, BinaryPredicate p) -> bool |
template<typename C > | |
constexpr auto | size (const C &c) -> decltype(c.size()) |
template<typename T , std::size_t N> | |
constexpr auto | size (const T(&)[N]) noexcept -> std::size_t |
template<class InputIt1 , class InputIt2 > | |
constexpr auto | lexicographical_compare (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2) -> bool |
template<typename Number > | |
constexpr auto | count_digits (Number val) -> enable_if_t< std::is_floating_point< Number >::value, int > |
Calculates the number of decimal digits needed to represent a number, plus one for negative numbers. More... | |
template<typename Number > | |
constexpr auto | count_digits (Number val, int base) -> int |
Calculates the number of digits needed to represent a number in a given base, plus one for negative numbers. More... | |
template<typename ForwardIt > | |
auto | max_count_digits (ForwardIt first, ForwardIt last) -> int |
Returns the necessary number of digits to represent the largest value in an input range. More... | |
template<typename ForwardIt > | |
auto | max_count_digits (ForwardIt first, ForwardIt last, int base) -> int |
Returns the necessary number of digits to represent the largest value in an input range. More... | |
template<typename Integral , typename CharT > | |
constexpr auto | to_bytes_le (Integral ival, CharT(&dest)[sizeof(Integral)]) noexcept -> void |
template<typename Integral , typename CharT > | |
constexpr auto | to_bytes_be (Integral ival, CharT(&dest)[sizeof(Integral)]) noexcept -> void |
template<typename Integral , typename CharT > | |
constexpr auto | to_bytes (Integral val, CharT(&dest)[sizeof(Integral)]) noexcept -> void |
template<typename HashInt , typename Span > | |
constexpr auto | FNVa (Span &&s, HashInt hval=fnv::fnv_offset< HashInt >::value) noexcept -> HashInt |
A templatized generic FNVa hash function. More... | |
template<typename HashInt , typename CharT , std::size_t N> | |
constexpr auto | FNVa_a (const CharT(&s)[N], HashInt hval=fnv::fnv_offset< HashInt >::value) noexcept -> HashInt |
A templatized FNVa hash function, for raw character arrays, such as string literals. More... | |
constexpr auto | FNV32a (std::string_view s, std::uint32_t hval=fnv::fnv_offset< std::uint32_t >::value) noexcept -> std::uint32_t |
A standard FNV32a hash function, for string_views. More... | |
template<typename HashInt > | |
constexpr auto | FNVa_s (const char *begin, std::size_t length, HashInt hval=fnv::fnv_offset< HashInt >::value) noexcept -> HashInt |
template<std::size_t N> | |
constexpr auto | FNV32a_a (const char(&s)[N], std::uint32_t hval=fnv::fnv_offset< std::uint32_t >::value) noexcept -> std::uint32_t |
A standard FNV32a hash function, for raw character arrays, such as string literals. More... | |
constexpr auto | FNV32a_s (const char *begin, std::size_t length, uint32_t hval=fnv::fnv_offset< std::uint32_t >::value) noexcept -> std::uint32_t |
constexpr auto | operator""_fnv32 (const char *str, std::size_t length) noexcept -> std::uint32_t |
A literal suffix that produces the FNV32a hash of a string literal. More... | |
constexpr auto | operator""_fnv64 (const char *str, std::size_t length) noexcept -> std::uint64_t |
A literal suffix that produces the FNV64a hash of a string literal. More... | |
constexpr auto | operator""_fnv32 (unsigned long long val) -> std::uint32_t |
constexpr auto | operator""_fnv64 (unsigned long long val) -> std::uint64_t |
template<typename string = std::string> | |
auto | toUTF8 (const icu::UnicodeString &s) -> string |
Convert a UnicodeString to a UTF-8 string. More... | |
template<typename string > | |
auto | fromUTF8 (string s) -> icu::UnicodeString |
Convert a UTF-8 string into a UnicodeString. More... | |
template<typename string = std::u32string> | |
auto | toUTF32 (const icu::UnicodeString &s) -> string |
Converts a UnicodeString to UTF-32. More... | |
template<typename string > | |
auto | fromUTF32 (string s) -> icu::UnicodeString |
Converts a UTF-32 string into a UnicodeString. More... | |
template<typename T > | |
auto | fromStr (const icu::UnicodeString &val, const char *type=typeid(T).name()) -> T |
Reencodes val to UTF-8 and then converts it to T using the primary overload. More... | |
template<typename D = std::string, typename std::enable_if_t< is_contiguous_v< D >, int > = 0> | |
auto | get_contents (std::istream &in, D &out) -> auto |
template<typename D = std::string, typename string > | |
auto | get_file_contents (const string &filename) -> std::optional< D > |
Read the entire contents of a file into a container, such as std::string or std::vector<char>. Note that it will be most efficient to read into contiguous containers, as opposed to non-contiguous containers. More... | |
template<typename D = std::string, typename string > | |
auto | try_get_file_contents (const string &filename) -> D |
Read the entire contents of a file into a container, such as std::string or std::vector<char>. Note that it will be most efficient to read into contiguous containers, as opposed to non-contiguous containers. More... | |
auto | getline (std::istream &is) -> std::string |
By-value std::getline wrapper. More... | |
auto | eat_word (std::istream &is) -> std::istream & |
Consume all non-spaces to first break, then eat that, too. More... | |
std::istream & | eat_space (std::istream &is) |
Eat spaces, don't eat an extra. More... | |
template<typename CharT , typename Traits > | |
auto | nl (std::basic_istream< CharT, Traits > &is) -> std::basic_istream< CharT, Traits > & |
Read in spaces until the end of the line is found. More... | |
template<typename CharT > | |
auto | unformatted_expect (CharT c) -> auto |
Read a character from an input stream only if it equals c. Acts as an UnformattedInputOperation, that is, it will not ignore any leading whitespace. More... | |
template<typename CharT > | |
auto | expect (CharT c) -> auto |
Read a character from an input stream only if it equals c. Acts as a FormattedInputOperation, that is, leading whitespace is ignored. More... | |
template<typename CharT , typename... O, template< typename, typename... > class string> | |
auto | get_line (string< CharT, O... > &str) -> auto |
Read a whole line into a std::basic_string-like class template. More... | |
template<typename CharT , typename... O, template< typename, typename... > class string> | |
auto | get_line (string< CharT, O... > &str, CharT delim) -> auto |
Read a delimited string into a std::basic_string-like class template. More... | |
template<typename F , typename CharT , typename Tr > | |
std::basic_istream< CharT, Tr > & | operator>> (std::basic_istream< CharT, Tr > &is, get_manip< F > func) |
Actually calls the manipulator. More... | |
template<typename F , typename CharT , typename Tr > | |
std::basic_ostream< CharT, Tr > & | operator<< (std::basic_ostream< CharT, Tr > &is, get_manip< F > func) |
Actually calls the manipulator. More... | |
template<typename StreamA , typename StreamB > | |
auto | tee (StreamA &a, StreamB &b) -> basic_teestream< StreamA, StreamB > |
template<typename File = std::fstream> | |
auto | scoped_file (const std::filesystem::path &path, std::ios_base::openmode mode=std::ios_base::in|std::ios_base::out) |
template<typename File = std::fstream> | |
auto | tmpfile (const std::filesystem::path &path, std::ios_base::openmode mode=std::ios_base::in|std::ios_base::out) |
template<typename P > | |
constexpr auto | to_pointer (P &&p) noexcept -> auto * |
Gets a raw pointer out of any smart pointer or iterator you might pass in, without dereferencing it or relying on a get() method. More... | |
template<typename Container , typename Comp = std::less<value_type_linear_t<Container>>> | |
auto | max_element (Container &c, Comp comp) -> value_type_linear_t< Container > * |
template<typename C > | |
counting_back_insert_iterator< C > | counting_back_inserter (C &c, std::size_t count=0) |
template<typename T > | |
constexpr auto | operator+ (T val, adjuster a) noexcept -> enable_if_t< not detail_iterators::is_addable< T, std::ptrdiff_t >::value, decltype(std::advance(val, a.adj))> |
template<typename T > | |
constexpr auto | operator+ (T val, incrementer) -> T |
Increments val. More... | |
template<typename T > | |
constexpr auto | operator+ (T val, decrementer) -> T |
Decrements val. More... | |
template<typename Value , typename Delta = int> | |
constexpr auto | range (Value min, Value max, Delta step=0) -> range_t< Value, Delta > |
Constructs a range from beginning, end, and step amount. The range is half-open, that is min is in the range but max is not. If unspecified, the step is automatically either 1 or -1, depending on whether max > min. More... | |
template<typename Value > | |
constexpr auto | range (Value max) -> range_t< Value, incrementer > |
Constructs a half-open range [0, max). The step is automatically determined based on the sign of max. More... | |
template<typename Value , typename Delta = int> | |
constexpr auto | irange (Value, Value, Delta=0) |
template<std::size_t I, typename T > | |
auto | get (enumeration< T > &&e) -> decltype(auto) |
template<std::size_t I, typename T > | |
auto | get (const enumeration< T > &&e) -> decltype(auto) |
template<std::size_t I, typename T > | |
auto | get (volatile enumeration< T > &e) -> decltype(auto) |
template<std::size_t I, typename T > | |
auto | get (const volatile enumeration< T > &e) -> decltype(auto) |
template<typename It , typename EIt > | |
auto | magic_enumerate (It begin, EIt end) -> enumerator_t< It, EIt > |
Allow access to indexes while using range-based for loops. More... | |
template<typename Range > | |
auto | magic_enumerate (Range &&r) -> auto |
Allow access to indexes while using range-based for loops. Safe to use with rvalues. More... | |
template<typename Iter1 , typename Iter2 > | |
constexpr auto | indirect (Iter1 begin, Iter2 end) noexcept(noexcept(indirect_range< Iter1, Iter2 >{begin, end})) -> indirect_range< Iter1, Iter2 > |
Create a range from an iterator pair. Primarily useful for range-for loops. More... | |
template<typename Iter1 , typename Iter2 > | |
indirect_range (Iter1, Iter2) -> indirect_range< Iter1, Iter2 > | |
template<typename Iter1 , typename Iter2 > | |
auto | cry_enumerate (Iter1 begin, Iter2 end) -> auto |
template<typename It , typename operation > | |
transform_iterator (It, operation) -> transform_iterator< It, operation > | |
template<typename base_iterator , typename operation > | |
auto | make_transform_iterator (base_iterator it, operation op) noexcept(noexcept(transform_iterator< base_iterator, operation >{ it, std::move(op)})) -> transform_iterator< base_iterator, operation > |
Factory function to make transform_iterators. More... | |
template<typename base_iterator , typename operation > | |
auto | transformer (base_iterator it, operation op) noexcept(noexcept(transform_iterator< base_iterator, operation >{it, std::move(op)})) -> transform_iterator< base_iterator, operation > |
Factory function to make transform_iterators. More... | |
template<typename It , typename EndIt , typename operation > | |
auto | transform_range (It begin, EndIt end, operation op) noexcept(noexcept(indirect(transform_iterator{begin, op}, end))) -> auto |
template<typename InputIt1 , typename EndIt , typename InputIt2 > | |
auto | zip (InputIt1 begin1, EndIt end1, InputIt2 begin2) noexcept(zip_iterator< InputIt1, EndIt, InputIt2 >::is_nothrow_copyable) -> zip_iterator< InputIt1, EndIt, InputIt2 > |
Iterate over two ranges in lockstep, like Python's zip. More... | |
template<typename Range1 , typename Range2 > | |
auto | zip (Range1 &&r1, Range2 &&r2) noexcept(zip_iterator< decltype(begin(r1)), decltype(end(r1)), decltype(begin(r2))>::is_nothrow_copyable) -> zip_iterator< decltype(begin(r1)), decltype(end(r1)), decltype(begin(r2))> |
Iterate over two ranges in lockstep, like Python's zip. More... | |
template<typename F > | |
auto | consumer (F f) -> consume_iterator< F > |
Creates a consume_iterator of deduced type F. More... | |
template<typename T , typename Deleter > | |
auto | make_cond_ptr (std::unique_ptr< T, Deleter > &&arg) noexcept -> cond_ptr< T, Deleter > |
template<typename T > | |
auto | make_cond_ptr (T *arg, bool owner=false) noexcept -> cond_ptr< T > |
template<typename T , typename Deleter > | |
auto | make_cond_ptr (T *arg, Deleter del) noexcept -> cond_ptr< T, Deleter > |
template<typename T , typename Deleter > | |
auto | make_cond_ptr (T *arg, bool owner, Deleter del) noexcept -> cond_ptr< T, Deleter > |
constexpr auto | operator| (construct_type l, construct_type r) noexcept -> construct_type |
constexpr auto | operator& (construct_type l, construct_type r) noexcept -> construct_type |
constexpr auto | operator* (construct_type l, bool r) noexcept -> construct_type |
template<typename T > | |
auto | noop (void *, const T *) -> T * |
Does nothing; matches the copy construction signature. More... | |
template<typename T , bool nothrow> | |
auto | noop (void *, T *) noexcept(nothrow) -> T * |
Does nothing; matches the move construction signature. More... | |
template<bool warn> | |
constexpr auto | poly_warn_if () -> std::nullptr_t |
template<> | |
constexpr auto | poly_warn_if< true > () -> std::nullptr_t |
template<typename Array , typename RandomGenerator , typename freqtype = double> | |
constexpr auto | chooseCategorical (Array &&cats, RandomGenerator &r) -> decltype(cats.size()) |
Given a categorical distribution cats, selects one category. More... | |
template<typename Gen , typename Source > | |
auto | seeded (Source &&s) -> Gen |
template<typename Gen > | |
auto | seeded () -> Gen |
template<typename UIntType > | |
constexpr auto | ipow2 (UIntType b) noexcept -> UIntType |
template<typename T > | |
constexpr auto | in_range (const T &v, detail_simple::simple_range< T > r) |
template<typename T > | |
constexpr auto | in_range_i (const T &v, detail_simple::simple_range< T > r) |
template<typename F , typename... T> | |
auto | 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 | defer (F f) |
template<typename BinaryOperation > | |
constexpr auto | flip () -> auto |
Transforms a stateless binary operation into one which takes reversed arguments. More... | |
template<typename BinaryOperation > | |
constexpr auto | flip (BinaryOperation op) -> auto |
Transforms a binary operation into one which takes reversed arguments. More... | |
template<typename T , std::size_t N> | |
constexpr auto | is_consecutive (const T(&array)[N]) -> enable_if_t< std::is_integral< T >::value, bool > |
constexpr auto | 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 | safe_auto (T &&in) -> T |
Safely propagate an xvalue or lvalue without dangling references. More... | |
template<typename T > | |
auto | safe_auto (T &in) -> T & |
Safely propagate an xvalue or lvalue without dangling references. More... | |
template<typename LeftContainer , typename RightContainer > | |
auto | 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 | a (const std::initializer_list< T > &a) -> auto |
Index an array literal without naming its type. More... | |
template<typename RandomAccessIt , typename Compare = std::less<>> | |
constexpr auto | insertion_sort (const RandomAccessIt begin, const RandomAccessIt end, Compare &&compare={}) noexcept(noexcept(swap(*begin, *begin)) and noexcept(compare(*begin, *begin))) -> void |
In-place insertion sort. As is usual, it is stable. Provides as a guarantee that it will perform no moves on sorted input. More... | |
template<typename RandomAccessIt , typename RandomAccessIt2 , typename Compare = std::less<>> | |
constexpr auto | insertion_sort_copy (const RandomAccessIt begin, const RandomAccessIt end, const RandomAccessIt2 d_begin, const RandomAccessIt2 d_end, Compare &&compare={}) noexcept(noexcept(detail_algorithm::shift_backward(d_begin, d_begin, d_end)) and noexcept(*d_begin= *begin)) -> void |
Out-of-place insertion sort, which does not modify the input. Provides as a guarantee that it will perform no moves on sorted input. More... | |
template<typename RandomAccessIt , typename RandomAccessIt2 , typename Compare = std::less<>> | |
constexpr auto | adaptive_insertion_sort_copy (const RandomAccessIt begin, const RandomAccessIt end, const RandomAccessIt2 d_begin, const RandomAccessIt2 d_end, Compare &&compare={}) noexcept(noexcept(detail_algorithm::shift_backward(d_begin, d_begin, d_end)) and noexcept(*d_begin= *begin)) -> void |
An adaptive sort which, at the cost of some additional work (time complexity Θ(sqrt(n))), avoids quadratic behavior for reverse-sorted inputs (and, in fact, handles them in optimal time). It's still possible to fool it, but it requires a staggered input, which is a highly unlikely shape for random data. More... | |
template<typename T > | |
constexpr auto | byte_count (T) noexcept -> enable_if_t< std::is_integral< T >::value, std::size_t > |
template<typename T > | |
constexpr auto | byte_count (T *) noexcept -> std::size_t |
template<typename T > | |
constexpr auto | byte_count (const std::unique_ptr< T > &) noexcept -> std::size_t |
template<typename T > | |
constexpr auto | byte_count (const T &x) noexcept -> enable_if_t< is_linear_container_v< T > and(std::is_integral< typename T::value_type >::value or is_byte_v< T >) and sizeof(typename T::value_type)==1, std::size_t > |
constexpr auto | byte_count (...) -> void=delete |
template<typename T > | |
constexpr auto | get_byte_index (T x, std::size_t idx) noexcept -> enable_if_t< std::is_integral< T >::value, unsigned char > |
template<typename T > | |
constexpr auto | get_byte_index (const T &x, std::size_t idx) noexcept -> enable_if_t< std::is_enum< T >::value, unsigned char > |
template<typename T > | |
auto | get_byte_index (T *x, std::size_t idx) noexcept -> unsigned char |
template<typename T > | |
auto | get_byte_index (const std::unique_ptr< T > &x, std::size_t idx) noexcept -> unsigned char |
template<typename RandomAccessIt , typename UnaryOperation , typename BinaryPredicate > | |
constexpr auto | sort_transform (RandomAccessIt begin, RandomAccessIt end, UnaryOperation &&transform, BinaryPredicate &&compare) -> void |
Sorts a range after applying a transformation. More... | |
template<typename RandomAccessIt , typename UnaryOperation > | |
constexpr auto | sort_transform (RandomAccessIt begin, RandomAccessIt end, UnaryOperation &&transform) -> void |
template<typename RandomAccessIt , typename BinaryPredicate > | |
constexpr auto | sort (RandomAccessIt begin, RandomAccessIt end, BinaryPredicate &&compare) -> void |
Sorts a range. More... | |
template<typename RandomAccessIt > | |
constexpr auto | sort (RandomAccessIt begin, RandomAccessIt end) -> void |
template<typename T , typename U > | |
constexpr auto | div (T num, U den) noexcept -> decltype(std::div(num, den)) |
template<typename U > | |
constexpr auto | calc_fib_size () noexcept -> std::size_t |
Calculate the index of the largest fibonacci number that can be represented by a given unsigned integral type. More... | |
template<typename U , std::size_t N = calc_fib_size<U>() + 1> | |
constexpr auto | make_fib_arr () noexcept -> trivial_array< U, N > |
Generates the first N values of the fibonacci sequence. More... | |
template<typename U = std::uintmax_t> | |
constexpr auto | fibonacci (int n) noexcept -> U |
Compile-time table fibonacci function. More... | |
template<typename T = double> | |
constexpr auto | pi () -> T |
template<typename T = double> | |
constexpr auto | tau () -> T |
template<typename T = double> | |
constexpr auto | e () -> T |
template<typename T = double> | |
constexpr auto | root_2 () -> T |
template<typename T = double> | |
constexpr auto | phi () -> T |
template<typename A , typename F > | |
constexpr auto | saturating_cast (F x) noexcept -> enable_if_t< std::is_integral< A >::value and std::is_integral< F >::value and std::is_unsigned< A >::value, A > |
template<typename T , typename F > | |
constexpr auto | quantize_step (F low, F delta, F val) noexcept -> T |
Quantize a real-valued value into a discrete integer. More... | |
template<typename T , typename F > | |
constexpr auto | quantize_range (F low, F high, F val) noexcept -> T |
Quantize a real-valued value into a discrete integer. More... | |
template<typename Str > | |
auto | strsize (Str &&str) -> std::size_t |
Determines the size in characters of any valid argument to concat or append. More... | |
template<typename CharT > | |
constexpr auto | length (const CharT *str) noexcept -> std::size_t |
template<typename string , typename F , typename... S> | |
auto | append (string &&out, F &&f, S &&... tail) -> void |
Given an object out of resizable stringlike type string, appends all other arguments to it. More... | |
template<typename string = std::string, typename F , typename... S> | |
auto | concat (F &&f, S &&... ins) -> string |
Returns a string consisting of the concatenation of all arguments. More... | |
template<typename string = std::string, typename str > | |
auto | concat (std::initializer_list< str > ins) -> string |
Returns a string consisting of the concatenation of all elements of an initializer list. More... | |
auto | isspace (char c) -> bool |
auto | isspace (wchar_t c) -> bool |
constexpr auto | isAspace (char c) -> bool |
constexpr auto | isAspace (wchar_t c) -> bool |
template<typename range , typename string = std::string> | |
auto | join (const range &in, const string &joiner="") |
Concatenates all elements of a range together with an optional joiner. More... | |
template<typename Container = std::vector<std::string>, typename Predicate , typename String > | |
auto | split_tokens (const String &in, Predicate spacer) -> return_assert_t< is_callable< Predicate, typename Container::value_type::value_type >::value, Container > |
Split a string on all condensed delimiters. More... | |
template<typename Container = std::vector<std::string>, typename String > | |
auto | split_tokens (const String &in) -> Container |
Split a string on all instances of whitespace. More... | |
template<typename Container = std::vector<std::string>, typename String > | |
auto | split_tokens (const String &in, typename Container::value_type::value_type delim) -> Container |
Split a string on all instances of a delimiter. More... | |
template<typename Container = std::vector<std::string>, typename String > | |
auto | kbsplit2 (const String &in, char delim=' ') -> Container |
template<typename Container = std::vector<std::string>, typename String > | |
auto | split_dsv (const String &str, char delim) -> Container |
Split a string on all instances of delim. More... | |
template<typename Container = std::vector<std::string>, typename String , typename Predicate > | |
auto | split_dsv (const String &str, Predicate delim) -> return_assert_t< is_callable< Predicate, typename Container::value_type::value_type >::value, Container > |
Split a string on all instances of delim. More... | |
template<typename string > | |
auto | reverse_str (string val) -> string |
Reverses all the elements of its input. More... | |
template<typename string > | |
constexpr auto | tolower (string str) -> string |
Folds all characters in a string using the default execution character set to lowercase. More... | |
template<typename string > | |
auto | toupper (string str) -> string |
Folds all characters in a string using the default execution character set to uppercase. More... | |
template<typename string > | |
auto | repeat (string val, std::size_t count) -> string |
Construct a string consisting of count copies of val concatenated together. More... | |
auto | repeat (char val, std::size_t count) -> std::string |
Construct a string consisting of count copies of val. More... | |
auto | ends_with (std::string_view haystack, std::string_view needle) -> bool |
Checks if a given string ends with a particular string. More... | |
auto | ends_with (std::string_view haystack, char needle) -> bool |
Checks if a given string ends with a particular string. More... | |
auto | starts_with (std::string_view haystack, std::string_view needle) -> bool |
Checks if a given string starts with a particular string. More... | |
auto | starts_with (std::string_view haystack, char needle) -> bool |
Checks if a given string starts with a particular string. More... | |
template<int trim, typename T , int N, typename Indices = std::make_integer_sequence<int, N - trim>> | |
constexpr auto | 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 | 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 | byte_cast (F v) noexcept -> T |
Creates a T with the same object representation as the given F. More... | |
template<typename C , typename std::enable_if< has_reserve_v< C >, int >::type = 0> | |
auto | 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... | |
template<typename To , typename... Ts> | |
auto | coerce (const std::variant< Ts... > &v) -> To |
Lexically converts the value of v (no matter its type) to type To. More... | |
template<typename To , typename... Ts> | |
auto | static_coerce (const std::variant< Ts... > &v) -> To |
static_casts the value of v (no matter its type) to type To. More... | |
template<typename To , typename... Ts> | |
auto | lexical_coerce (const std::variant< Ts... > &v) -> To |
Lexically converts the value of v (no matter its type) to type To. More... | |
template<typename... Ts> | |
visitor (Ts...) -> visitor< Ts... > | |
template<char... Cs> | |
constexpr auto | operator""_vi () |
template<typename Variant , typename... Fs> | |
constexpr auto | visit_indexed (Variant &&variant, Fs &&... fs) -> decltype(auto) |
Visit a variant, but pass the index (as an integral_constant) to the visitor. This allows for a visitor of a variant with duplicated types to maintain index information. More... | |
template<typename To , typename From > | |
constexpr auto | variant_cast (From &&v) -> To |
Promotes an input variant to a super-variant. That is, one which provides at least the same set of types. More... | |
template<typename V , typename F , typename... Fs> | |
constexpr auto | visit (V &&v, F &&f, Fs &&... fs) -> decltype(auto) |
Wraps std::visit to provide an interface taking one variant and any number of functors providing an overload set. More... | |
template<typename V , typename F , typename... Fs> | |
constexpr auto | visit2 (V &&v, F &&f, Fs &&... fs) -> decltype(auto) |
template<typename V , typename F , typename... Fs> | |
constexpr auto | visit2_nop (V &&v, F &&f, Fs &&... fs) -> void |
template<typename V > | |
constexpr auto | visit (V &v) -> auto |
Two-step visiting interface. Takes a variant, and returns an object which can be called with any number of callable arguments, builds an overload set from them, and visits the variant. More... | |
Variables | |
template<typename Int > | |
constexpr int | bits_of = std::numeric_limits<Int>::digits |
constexpr struct kblib::build_end_t | build_end |
struct { | |
} | swap |
template<typename T > | |
constexpr bool | value_detected_v = value_detected<T>::value |
template<typename T > | |
constexpr bool | key_detected_v = key_detected<T>::value |
template<typename T > | |
constexpr bool | mapped_detected_v = mapped_detected<T>::value |
template<typename T > | |
constexpr bool | hash_detected_v = hash_detected<T>::value |
constexpr struct kblib::in_place_agg_t | in_place_agg |
template<typename T > | |
constexpr int | padding_bits_v |
Get the number of padding bits in an integral type. More... | |
template<> | |
constexpr int | padding_bits_v< void > = 0 |
template<typename Key > | |
KBLIB_CONSTANT_V | is_hashable_v = is_hashable<Key>::value |
template<typename T > | |
KBLIB_CONSTANT_V | is_trivially_hashable_v |
template<bool A, bool B> | |
constexpr bool | implies_v = implies<A, B>::value |
template<bool... args> | |
constexpr bool | conjunction_v = (args and ...) |
template<typename T > | |
constexpr std::size_t | state_size_v = state_size<T>::value |
template<typename T , typename = void> | |
constexpr std::size_t | seed_discard_v = 0 |
template<typename... Ts> | |
constexpr bool | any_void = (std::is_void_v<Ts> or ...) |
template<typename T > | |
constexpr bool | is_radix_sortable_v = is_radix_sortable<T>::value |
template<typename T > | |
constexpr bool | is_byte_v = false |
constexpr struct kblib::nums::max_t | max |
constexpr struct kblib::nums::min_t | min |
template<typename C > | |
constexpr bool | is_character_v = is_character<C>::value |
Equivalent to is_character<C>::value. More... | |
constexpr endian | system_endian = endian::unknown |
constexpr endian | hash_order = detail::get_hash_order() |
template<typename... Ts> | |
KBLIB_CONSTANT_V | contains_type_v = contains_type<Ts...>::value |
template<typename... Ts> | |
KBLIB_CONSTANT_V | contains_types_v = contains_types<Ts...>::value |
template<typename C > | |
KBLIB_CONSTANT_V | is_resizable_v = decltype(detail::calc_resizable<C>(0))::value |
template<typename C , typename = void> | |
KBLIB_CONSTANT_V | has_reserve_v = false |
template<typename C , typename = void> | |
KBLIB_CONSTANT_V | is_contiguous_v = false |
Type trait to determine if a container is contiguous. More... | |
template<typename T > | |
KBLIB_CONSTANT_V | is_input_iterator_v = is_input_iterator<T>::value |
template<typename T > | |
KBLIB_CONSTANT_V | is_forward_iterator_v = is_forward_iterator<T>::value |
template<typename T > | |
KBLIB_CONSTANT_V | is_bidirectional_iterator_v = is_bidirectional_iterator<T>::value |
template<typename T > | |
KBLIB_CONSTANT_V | is_random_access_iterator_v = is_random_access_iterator<T>::value |
template<typename T > | |
KBLIB_CONSTANT_V | is_iterable_v = is_iterable<T>::value |
template<typename T > | |
KBLIB_CONSTANT_V | is_iterator_v = is_iterator<T>::value |
template<typename T > | |
KBLIB_CONSTANT_V | 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 | 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 | is_aliasing_type_v = is_aliasing_type<T>::value |
template<typename T , typename = void> | |
constexpr bool | is_variant_like_v = false |
The main namespace in which all entities from kblib are defined.
using kblib::alias = typedef T |
using kblib::bool_constant = typedef std::integral_constant<bool, v> |
using kblib::class_of_t = typedef typename class_of<T>::type |
using kblib::copy_const_t = typedef typename copy_const<C, V>::type |
using kblib::decay_t = typedef typename std::decay<T>::type |
using kblib::default_extractor_t = typedef typename std::conditional< extractor_policy_for<Container>::value == extractor_policy::random_access, indexer_extractor<Container>, iterator_extractor<Container> >::type |
using kblib::enable_if_t = typedef typename std::enable_if<B, T>::type |
using kblib::FNV32_hash = typedef FNV_hash<Key, std::uint32_t> |
using kblib::hash_detected_t = typedef typename hash_detected<T>::type |
using kblib::hash_map = typedef std::unordered_map<Key, Value, FNV_hash<>, std::equal_to<> > |
using kblib::hash_multimap = typedef std::unordered_multimap<Key, Value, FNV_hash<>, std::equal_to<> > |
using kblib::hash_multiset = typedef std::unordered_set<T, FNV_hash<>, std::equal_to<> > |
using kblib::hash_set = typedef std::unordered_set<T, FNV_hash<>, std::equal_to<> > |
using kblib::ignore_t = typedef typename ignore<U, T>::type |
An alias for ignore<U, T>::type.
using kblib::int_smallest = typedef 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 |
using kblib::int_smallest_t = typedef typename int_smallest<I>::type |
using kblib::iterator_type_for_t = typedef typename iterator_type_for<Range>::type |
using kblib::key_detected_t = typedef typename key_detected<T>::type |
using kblib::key_type_setlike_t = typedef typename key_type_setlike<Container>::type |
using kblib::mapped_detected_t = typedef typename mapped_detected<T>::type |
using kblib::member_of_t = typedef typename member_of<T>::type |
using kblib::meta_type_t = typedef typename meta_type<Ts...>::type |
using kblib::metafunction_value_t = typedef std::integral_constant<decltype(T::value), T::value> |
using kblib::move_only_traits = typedef poly_obj_traits<Obj, construct_type::move> |
Definition at line 452 of file poly_obj.h.
using kblib::no_move_traits = typedef poly_obj_traits<Obj, construct_type::none> |
Definition at line 454 of file poly_obj.h.
using kblib::owner = typedef T |
using kblib::remove_cvref_t = typedef typename std::remove_reference<typename std::remove_cv<T>::type>::type |
using kblib::remove_reference_t = typedef typename std::remove_reference<T>::type |
using kblib::return_assert_t = typedef typename return_assert<V, T>::type |
using kblib::safe_signed_t = typedef typename safe_signed<N>::type |
using kblib::uint_smallest = typedef typename first_bigger_than<1 + filg2(I) / CHAR_BIT, unsigned char, unsigned short, unsigned int, unsigned long, unsigned long long, std::uintmax_t>::type |
using kblib::uint_smallest_t = typedef typename uint_smallest<I>::type |
using kblib::value_detected_t = typedef typename value_detected<T>::type |
using kblib::value_type_linear_t = typedef typename value_type_linear<Container>::type |
using kblib::void_if_t = typedef typename void_if<b>::type |
|
strong |
Enumerator | |
---|---|
none | |
copy_only | |
move | |
both | |
throw_move | |
both_throw |
Definition at line 40 of file poly_obj.h.
|
strong |
|
strong |
|
constexpr |
Index an array literal without naming its type.
a | The array literal to index into. |
|
constexpr |
A constexpr version of std::accumulate.
Definition at line 162 of file algorithm.h.
|
constexpr |
A constexpr version of std::accumulate.
Definition at line 174 of file algorithm.h.
|
constexprnoexcept |
An adaptive sort which, at the cost of some additional work (time complexity Θ(sqrt(n))), avoids quadratic behavior for reverse-sorted inputs (and, in fact, handles them in optimal time). It's still possible to fool it, but it requires a staggered input, which is a highly unlikely shape for random data.
begin,end | The input range |
d_begin,d_end | The output range |
compare | The comparison predicate |
|
constexpr |
Determine if pred is true for every element of the range.
Definition at line 970 of file algorithm.h.
|
constexpr |
Determine if pred is true for every element of the range.
Definition at line 984 of file algorithm.h.
|
constexpr |
Determine if pred is true for at least one element of the range.
Definition at line 1024 of file algorithm.h.
|
constexpr |
Determine if pred is true for every element of the range.
Definition at line 1038 of file algorithm.h.
auto kblib::append | ( | string && | out, |
F && | f, | ||
S &&... | tail | ||
) | -> void |
Given an object out of resizable stringlike type string, appends all other arguments to it.
Stringlike types and characters are simply appended, while arithmetic types are first converted to strings using std::to_string.
out | The string to append to. |
f | The first value to append to out. |
tail | Any number of subsequent values to append to out. |
Definition at line 251 of file stringops.h.
|
constexprnoexcept |
|
noexcept |
auto kblib::build | ( | Functor | f, |
size_t | size, | ||
typename Container::allocator_type | allocator = typename Container::allocator_type{} |
||
) | -> Container |
Constructs a container with elements initialized by repeatedly calling a generating function.
Container | The type of container to return. Must be an AllocatorAware SequenceContainer. |
f | The functor to repeatedly invoke. |
size | The number of times to invoke f . |
allocator | The allocator to use for the returned container. |
f
in sequence. auto kblib::build | ( | Functor | f, |
size_t | size = std::tuple_size<Array>::value |
||
) | -> Array |
Constructs an array-like container with elements initialized by repeatedly calling a generating function.
Array | The type of container to return. Must be a non-resizable Container similar to std::array. |
f | The functor to repeatedly invoke. |
size | The number of times to invoke f . Defaults to the size of the Container, which is usually correct. |
f
in sequence. auto kblib::build | ( | InputIt | first, |
InputIt | last, | ||
InputIt2 | first2, | ||
BinaryFunction | f | ||
) | -> Array |
Constructs an array-like container by applying a BinaryFunction to every pair of elements in the input ranges.
first | Beginning of input range. |
last | End of input range. |
first2 | Beginning of second input range |
f | A BinaryFunction to apply to the elements of the two input ranges. |
Array | The type of container to return. Must be a non-resizable Container similar to std::array. |
auto kblib::build | ( | InputIt | first, |
InputIt | last, | ||
InputIt2 | first2, | ||
BinaryFunction | f, | ||
typename Container::allocator_type | allocator = typename Container::allocator_type{} |
||
) | -> Container |
Constructs a container by applying a BinaryFunction to every pair of elements in the input ranges.
first | Beginning of input range. |
last | End of input range. |
first2 | Beginning of second input range |
f | A BinaryFunction to apply to the elements of the two input ranges. |
Container | The type of container to return. Must be an AllocatorAware SequenceContainer. |
allocator | The allocator to use for the returned container. |
auto kblib::build | ( | InputIt | first, |
InputIt | last, | ||
UnaryFunction | f | ||
) | -> Array |
Constructs an array-like container by applying a UnaryFunction to every element of an input range.
first | Beginning of input range. |
last | End of input range. |
f | A UnaryFunction to apply to each element of the input range. |
Array | The type of container to return. Must be a non-resizable Container similar to std::array. |
auto kblib::build | ( | InputIt | first, |
InputIt | last, | ||
UnaryFunction | f, | ||
typename Container::allocator_type | allocator = typename Container::allocator_type{} |
||
) | -> Container |
Constructs a container by applying a UnaryFunction to every element of an input range.
first | Beginning of input range. |
last | End of input range. |
f | A UnaryFunction to apply to each element of the input range. |
Container | The type of container to return. Must be an AllocatorAware SequenceContainer. |
allocator | The allocator to use for the returned container. |
|
constexpr |
auto kblib::build_copy | ( | InputIt | first, |
InputIt | last, | ||
std::size_t | size | ||
) | -> Container |
auto kblib::build_copy | ( | InputIt | first, |
InputIt | last, | ||
typename Container::allocator_type | allocator = typename Container::allocator_type{} |
||
) | -> Container |
auto kblib::build_copy | ( | Range && | r | ) | -> Container |
|
constexpr |
auto kblib::build_copy | ( | Range && | r, |
std::size_t | size | ||
) | -> Container |
auto kblib::build_copy | ( | Range && | r, |
typename Container::allocator_type | allocator = typename Container::allocator_type{} |
||
) | -> Container |
auto kblib::build_copy_if | ( | InputIt | first, |
InputIt | last, | ||
Predicate | f, | ||
typename Container::allocator_type | allocator = typename Container::allocator_type{} |
||
) | -> Container |
auto kblib::build_copy_n | ( | InputIt | first, |
Size | count, | ||
typename Container::allocator_type | allocator = typename Container::allocator_type{} |
||
) | -> Container |
auto kblib::build_copy_n_if | ( | InputIt | first, |
Size | count, | ||
Predicate | f, | ||
typename Container::allocator_type | allocator = typename Container::allocator_type{} |
||
) | -> Container |
auto kblib::build_dy | ( | Functor | f, |
size_t | size | ||
) | -> Container |
Constructs a container with elements initialized by repeatedly calling a generating function. Exactly like build
, but for resizable non-AllocatorAware Containers (which are hard to detect automatically).
f | The functor to repeatedly invoke. |
size | The number of times to invoke f . |
f
in sequence. auto kblib::build_dy | ( | InputIt | first, |
InputIt | last, | ||
InputIt2 | first2, | ||
BinaryFunction | f | ||
) | -> Container |
Constructs a container by applying a BinaryFunction to every pair of elements in the input ranges. Exactly like build
, but for resizable non-AllocatorAware Containers (which are hard to detect automatically).
first | Beginning of input range. |
last | End of input range. |
first2 | Beginning of second input range |
f | A BinaryFunction to apply to the elements of the two input ranges. |
Container | The type of container to return. Must be a resizable SequenceContainer. |
auto kblib::build_dy | ( | InputIt | first, |
InputIt | last, | ||
UnaryFunction | f | ||
) | -> Container |
Constructs a container by applying a UnaryFunction to every element of an input range. Exactly like build
, but for resizable non-AllocatorAware Containers (which are hard to detect automatically).
first | Beginning of input range. |
last | End of input range. |
f | A UnaryFunction to apply to each element of the input range. |
Container | The type of container to return. Must be a resizable SequenceContainer. |
auto kblib::build_dy | ( | Range && | r, |
UnaryFunction | f | ||
) | -> Container |
|
constexpr |
Builds a container of increasing values.
Container | Either a resizable (like std::vector) or non-resizable (like std::array) Container. |
args | If Container is resizable, the first argument is the size of container to return, otherwise there is no size argument. The next argument is always the starting value. Optionally, an increment may be specified as a final argument. |
|
noexcept |
|
constexprdelete |
|
constexprnoexcept |
|
constexprnoexcept |
|
constexprnoexcept |
|
constexprnoexcept |
|
constexprnoexcept |
Calculate the index of the largest fibonacci number that can be represented by a given unsigned integral type.
bits N fibonacci(N) -------------------------------------------------- 8 13 144 16 24 28657 32 47 1836311903 64 93 7540113804746346429 128 186 205697230343233228174223751303346572685
|
inline |
auto kblib::calculate_translated_index | ( | string && | value, |
const char * | p | ||
) | -> std::ptrdiff_t |
|
constexprnoexcept |
Definition at line 1603 of file algorithm.h.
|
constexpr |
Given a categorical distribution cats, selects one category.
cats | A sequence of category weights |
r | A <random>-compatible RandomGenerator |
auto kblib::coerce | ( | const std::variant< Ts... > & | v | ) | -> To |
Lexically converts the value of v (no matter its type) to type To.
v | A variant to coerce. |
auto kblib::concat | ( | F && | f, |
S &&... | ins | ||
) | -> string |
Returns a string consisting of the concatenation of all arguments.
Arithmetic types are first converted by calling std::to_string.
f | The first argument to concatenate. |
ins | Any number of arguments to concatenate onto f. |
Definition at line 305 of file stringops.h.
auto kblib::concat | ( | std::initializer_list< str > | ins | ) | -> string |
Returns a string consisting of the concatenation of all elements of an initializer list.
ins | A series of values to concatenate together. |
Definition at line 319 of file stringops.h.
|
constexpr |
Allows for constructing a container of a specified type from a range object. Copy elision means that this does not result in any extra copies.
Container | The container type to construct an object of. |
r | The range to construct the returned container from. |
Definition at line 152 of file containers.h.
auto kblib::consumer | ( | F | f | ) | -> consume_iterator<F> |
Creates a consume_iterator of deduced type F.
This could be a deduction guide, if kblib didn't also support C++14. Thus, the old style is used for compatibility.
f | A functor to call on assignment. |
Definition at line 1614 of file iterators.h.
|
constexprnoexcept |
Determine if a range contains a value.
Definition at line 1063 of file algorithm.h.
|
constexprnoexcept |
Determine if a range contains a value.
Definition at line 1052 of file algorithm.h.
|
constexpr |
Definition at line 1087 of file algorithm.h.
|
constexpr |
Definition at line 1076 of file algorithm.h.
|
constexpr |
Definition at line 1098 of file algorithm.h.
|
constexpr |
Copies all elements of [first
, last
) to out. It also allows for a sentinel end iterator.
constexpr
in C++14.first | The beginning of the input range |
last | The end of the input range |
out | The beginning of the output range |
Definition at line 1322 of file algorithm.h.
|
constexpr |
Copies those elements of [first
, last
) which satisfy pred to out. It also allows for a sentinel end iterator.
constexpr
in C++14.first | The beginning of the input range |
last | The end of the input range |
out | The beginning of the output range |
pred | The predicate to apply |
Definition at line 1343 of file algorithm.h.
|
constexpr |
Copies all elements of [first
, std::advance(first, n)
) to out.
constexpr
in C++14.first | The beginning of the input range. |
count | The number of elements in the input range. |
out | The output range. |
Definition at line 1365 of file algorithm.h.
|
constexpr |
Copies those elements of [first
, std::advance(first, n)
) which satisfy pred to out.
constexpr
in C++14.first | The beginning of the input range. |
count | The number of elements in the input range. |
out | The output range. |
pred | The predicate to apply. |
Definition at line 1386 of file algorithm.h.
|
constexpr |
Calculates the number of decimal digits needed to represent a number, plus one for negative numbers.
Calculates the number of decimal digits needed to represent a number.
val | The number to be checked. |
|
constexpr |
counting_back_insert_iterator< C > kblib::counting_back_inserter | ( | C & | c, |
std::size_t | count = 0 |
||
) |
Definition at line 203 of file iterators.h.
auto kblib::cry_enumerate | ( | Iter1 | begin, |
Iter2 | end | ||
) | -> auto |
Definition at line 1071 of file iterators.h.
auto kblib::cry_enumerate | ( | Range && | range | ) | -> auto |
Definition at line 186 of file enumerate-contrib-cry.h.
|
constexprnoexcept |
auto kblib::duration_to_str | ( | std::chrono::duration< Rep, Ratio > & | d | ) | -> std::string |
auto kblib::duration_to_str | ( | std::chrono::duration< Rep, std::ratio< 3600 > > | d | ) | -> std::string |
auto kblib::duration_to_str | ( | std::chrono::duration< Rep, std::ratio< 60 > > | d | ) | -> std::string |
|
constexpr |
|
inline |
|
inline |
|
constexpr |
Checks if a given range ends with a particular subrange.
Definition at line 781 of file algorithm.h.
|
constexpr |
Checks if a given range ends with a particular subrange.
Definition at line 803 of file algorithm.h.
|
inline |
Checks if a given string ends with a particular string.
haystack | The string to be checked. |
needle | The suffix to check for. |
Definition at line 668 of file stringops.h.
|
inline |
Checks if a given string ends with a particular string.
haystack | The string to be checked. |
needle | The suffix to check for. |
Definition at line 654 of file stringops.h.
|
constexpr |
Allow access to indexes while using range-based for loops.
begin,end | The input range. |
Definition at line 169 of file enumerate-contrib-tw.h.
|
constexpr |
Allow access to indexes while using range-based for loops. Safe to use with rvalues.
r | A range to iterate over. |
Definition at line 159 of file enumerate-contrib-tw.h.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexprnoexcept |
Synthesize an equivalence relation from <.
Definition at line 94 of file algorithm.h.
|
constexprnoexcept |
Synthesize an equivalence relation from comp.
Definition at line 106 of file algorithm.h.
|
constexprnoexcept |
Abbreviation of the erase-remove idiom as a free function.
c | The container to erase from. |
val | The value to remove. |
Definition at line 68 of file algorithm.h.
|
constexprnoexcept |
Abbreviation of the erase-remove idiom as a free function.
c | The container to erase from. |
p | Erase all elements on which p returns true. |
Definition at line 81 of file algorithm.h.
auto kblib::escapify | ( | const string & | value | ) | -> std::string |
|
constexpr |
|
constexpr |
auto kblib::expect | ( | CharT | c | ) | -> auto |
|
constexprnoexcept |
Compile-time table fibonacci function.
|
constexprnoexcept |
|
constexprnoexcept |
Finds a value in range [begin, end). If not found, returns end. It also allows for a sentinel end iterator.
begin,end | The range to search in |
value | The value to search for |
Definition at line 290 of file algorithm.h.
|
constexprnoexcept |
Finds a value in range [begin, end). If not found, returns end. It also allows for a sentinel end iterator.
begin,end | The range to search in |
value | The value to search for |
comp | The comparison function |
Definition at line 309 of file algorithm.h.
|
constexprnoexcept |
Finds the first value in range [begin, end) for which pred returns true. If not found, returns end. It also allows for a sentinel end iterator.
begin,end | The range to search in |
pred | The predicate to scan with |
Definition at line 327 of file algorithm.h.
|
constexprnoexcept |
Finds the first value in range [begin, end) for which pred returns false. If not found, returns end. It also allows for a sentinel end iterator.
begin,end | The range to search in |
pred | The predicate to scan with |
Definition at line 346 of file algorithm.h.
|
constexprnoexcept |
Find the first element in c equal to v and return the position.
Equivalent to find_in(begin(c), end(c), v)
c | The container to search. |
value | The value to search for. |
Definition at line 559 of file algorithm.h.
|
constexprnoexcept |
Find the offset of the first ocurrence of v in a range from the beginning. It also allows for a sentinel end iterator.
begin,end | The range to search in |
value | The value to search for. |
Definition at line 458 of file algorithm.h.
|
constexprnoexcept |
Find the first element in c for which p returns true and return the position.
Equivalent to find_in_if(begin(c), end(c), p)
c | The container to search in. |
pred | The predicate to check. |
Definition at line 585 of file algorithm.h.
|
constexprnoexcept |
Find the offset of the first element for which p returns true. It also allows for a sentinel end iterator.
begin,end | The range to search in |
pred | The predicate to check. |
Definition at line 474 of file algorithm.h.
|
constexprnoexcept |
Find the first element in c for which p returns false and return the position.
Equivalent to find_in_if_not(begin(c), end(c), p)
c | The container to search in. |
pred | The predicate to check. |
Definition at line 607 of file algorithm.h.
|
constexprnoexcept |
Find the offset of the first element for which p returns false. It also allows for a sentinel end iterator.
begin,end | The range to search in |
pred | The predicate to check. |
Definition at line 490 of file algorithm.h.
|
constexprnoexcept |
Searches a range for the last occurence of a match, and returns an iterator to it. It also allows for a sentinel end iterator.
begin,end | The range to search in |
value | The value to find |
Definition at line 366 of file algorithm.h.
|
constexprnoexcept |
Searches a range for the last element on which a predicate returns true. It also allows for a sentinel end iterator.
begin,end | The range to search in |
pred | The predicate for comparison |
Definition at line 396 of file algorithm.h.
|
constexprnoexcept |
Searches a range for the last element on which a predicate returns false. It also allows for a sentinel end iterator.
begin,end | The range to search in |
pred | The predicate for comparison |
Definition at line 427 of file algorithm.h.
|
constexprnoexcept |
Find the last element in c equal to v and return the position.
Equivalent to find_last_in(std::begin(c), std::end(c), v)
c | The container to search. |
value | The value to search for. |
Definition at line 645 of file algorithm.h.
|
constexprnoexcept |
Find the offset of the last ocurrence of v in a range from the beginning. It also allows for a sentinel end iterator.
begin,end | The range to search in |
value | The value to search for. |
Definition at line 510 of file algorithm.h.
|
constexprnoexcept |
Find the last element in c for which p returns true and return the position.
Equivalent to find_last_in_if(std::begin(c), std::end(c), p)
c | The container to search in. |
pred | The predicate to check. |
Definition at line 664 of file algorithm.h.
|
constexprnoexcept |
begin,end | The range to search in |
begin,end | The range to search in |
pred | The predicate to check. |
Definition at line 525 of file algorithm.h.
|
constexprnoexcept |
Find the last element in c for which p returns true and return the position.
Equivalent to find_last_in_if_not(std::begin(c), std::end(c), p)
c | The container to search in. |
pred | The predicate to check. |
Definition at line 686 of file algorithm.h.
|
constexprnoexcept |
Find the offset of the last element for which p returns false. It also allows for a sentinel end iterator.
begin,end | The range to search in |
pred | The predicate to check. |
Definition at line 541 of file algorithm.h.
|
constexpr |
Definition at line 701 of file algorithm.h.
|
constexpr |
Definition at line 717 of file algorithm.h.
|
constexpr |
Definition at line 821 of file algorithm.h.
|
constexpr |
Definition at line 851 of file algorithm.h.
|
constexpr |
Definition at line 835 of file algorithm.h.
|
constexpr |
Definition at line 868 of file algorithm.h.
|
constexpr |
Definition at line 898 of file algorithm.h.
|
constexpr |
Definition at line 881 of file algorithm.h.
|
constexpr |
Definition at line 920 of file algorithm.h.
|
constexpr |
Definition at line 950 of file algorithm.h.
|
constexpr |
Definition at line 934 of file algorithm.h.
|
constexpr |
Transforms a stateless binary operation into one which takes reversed arguments.
For example, kblib::flip<std::minus<>>() returns a function object which subtracts its first argument from its second.
BinaryOperation | The operation to reverse. |
|
constexpr |
Transforms a binary operation into one which takes reversed arguments.
For example, kblib::flip(std::minus<>{}) returns a function object which subtracts its first argument from its second.
op | The operation to reverse. |
|
constexprnoexcept |
A standard FNV32a hash function, for string_views.
s | The data to hash. |
hval | The initial value for the hash accumulator. Pass in another hash value to create a hash of the concatenation of the two ranges. |
|
constexprnoexcept |
A standard FNV32a hash function, for raw character arrays, such as string literals.
s | The data to hash. |
hval | The initial value for the hash accumulator. Pass in another hash value to create a hash of the concatenation of the two ranges. |
|
constexprnoexcept |
|
constexprnoexcept |
A templatized generic FNVa hash function.
HashInt | The unsigned integer type to use as the hash result. Must be either std::uint32_t or std::uint64_t. |
s | The data to hash. Any range-for-iterable span of char-like objects. |
hval | The initial value for the hash accumulator. Pass in another hash value to create a hash of the concatenation of the two ranges. |
|
constexprnoexcept |
A templatized FNVa hash function, for raw character arrays, such as string literals.
HashInt | The unsigned integer type to use as the hash result. Must be either std::uint32_t or std::uint64_t. |
s | The data to hash. A raw array of char-like objects. |
hval | The initial value for the hash accumulator. Pass in another hash value to create a hash of the concatenation of the two ranges. |
|
constexprnoexcept |
|
constexpr |
Applies a binary operation to each pair of corresponding elements in two input ranges. It also allows for a sentinel end iterator.
In the style of <algorithm> algorithms, the second range is simply assumed to be at least as large as the first.
first | The beginning of the first input range. |
last | The end of the first input range. |
second | The beginning of the second input range. |
f | The operation to apply. |
Definition at line 1280 of file algorithm.h.
|
constexpr |
Applies a binary operation to each pair of corresponding elements in two input ranges.
first | The beginning of the first input range. |
n | The number of elements to operate on in each input range. |
second | The beginning of the second input range. |
f | The operation to apply. |
{std::advance(first,
n), std::advance(second, n)}
Definition at line 1301 of file algorithm.h.
auto kblib::force_shrink_to_fit | ( | V & | vec | ) | -> void |
std::vector::shrink_to_fit is non-binding, which means that there is no guaranteed way to shrink a vector via its API. This function is a roundabout way of doing that without relying on the sanity of the implementation (except that it assumes that a vector won't significantly over-allocate on sized construction).
This function explicitly constructs a new vector and moves into it, before overwriting the old vector with the new one, meaning that the vector is forced to forget its capacity.
This function provides the strong exception guarantee.
vec | The vector to force-shrink. |
Definition at line 116 of file containers.h.
auto kblib::fromStr | ( | const char * | val, |
const char * | type = typeid(To).name() , |
||
_ | = 0 |
||
) | -> To |
auto kblib::fromStr | ( | const char(&) | val[N], |
const char * | type = typeid(To).name() |
||
) | -> To |
auto kblib::fromStr | ( | const icu::UnicodeString & | val, |
const char * | type = typeid(T).name() |
||
) | -> T |
|
inline |
|
inline |
|
inline |
auto kblib::fromStr | ( | const std::string & | val, |
const char * | type = typeid(T).name() |
||
) | -> T |
|
inlinedelete |
|
inlinedelete |
|
inlinedelete |
auto kblib::fromStr | ( | std::string && | val, |
const char * | type = typeid(T).name() |
||
) | -> T |
|
inline |
|
inline |
|
inline |
auto kblib::fromStr | ( | std::string_view | val, |
const char * | type = typeid(T).name() |
||
) | -> T |
auto kblib::fromUTF32 | ( | string | s | ) | -> icu::UnicodeString |
auto kblib::fromUTF8 | ( | string | s | ) | -> icu::UnicodeString |
|
constexprnoexcept |
Like std::generate except that it returns the output iterator at the end. It also allows for a sentinel end iterator.
first | The beginning of the ouput range. |
last | The end of the output range. |
g | A generator to repeatedly call and assign the return values to the elements of the output range. |
Definition at line 1545 of file algorithm.h.
|
constexprnoexcept |
Like std::generate_n except that it is constexpr.
first | The beginning of the ouput range. |
count | The number of elements to generate. |
g | A generator to repeatedly call and assign the return values to the elements of the output range. |
Definition at line 1565 of file algorithm.h.
auto kblib::get | ( | const enumeration< T > && | e | ) | -> decltype(auto) |
Definition at line 834 of file iterators.h.
|
noexcept |
|
noexcept |
auto kblib::get | ( | const volatile enumeration< T > & | e | ) | -> decltype(auto) |
Definition at line 855 of file iterators.h.
auto kblib::get | ( | enumeration< T > && | e | ) | -> decltype(auto) |
Definition at line 825 of file iterators.h.
|
noexcept |
|
noexcept |
auto kblib::get | ( | volatile enumeration< T > & | e | ) | -> decltype(auto) |
Definition at line 845 of file iterators.h.
|
noexcept |
|
constexprnoexcept |
|
noexcept |
|
constexprnoexcept |
|
constexprnoexcept |
Definition at line 94 of file containers.h.
auto kblib::get_contents | ( | std::istream & | in, |
D & | out | ||
) | -> auto |
auto kblib::get_file_contents | ( | const string & | filename | ) | -> std::optional<D> |
Read the entire contents of a file into a container, such as std::string or std::vector<char>. Note that it will be most efficient to read into contiguous containers, as opposed to non-contiguous containers.
filename | The filename to open. |
D | A contiguous sequence container, which will be created and filled with the contents of the file to be read. |
|
inline |
|
inline |
Read a delimited string into a std::basic_string-like class template.
When used like os >> get_line(str, '
'); for a std::ostream& os and std::string str, reads a full line into str instead of just a single word.
str | The string to read into. |
delim | The delimiter at which to stop reading text. |
|
constexpr |
Copies the count greatest elements according to cmp of the range [first, last) to the range beginning at d_begin.
Note that this function uses O(count) extra memory to store a mutable range for sorting. Directly calling std::partial_sort_copy with a properly sized container will be more efficient than this function because it avoids allocating extra working memory. This function should rather be used for non-random-access output ranges.
first | The beginning of the range. |
last | One past the end of the range. |
d_begin | The beginning of the output range. |
count | The number of elements to copy out of the range. |
cmp | The comparison function to use. |
Definition at line 1257 of file algorithm.h.
|
constexpr |
Returns a container of the greatest count elements according to cmp of the range [first, last), in descending order. This overload works for linear containers.
Returns a container of the greatest count elements according to cmp of the range [first, last). This overload works for set-like containers.
first | The beginning of the range. |
last | One past the end of the range. |
count | The number of elements to copy out of the range. |
cmp | The comparison function to use. |
first | The beginning of the range. |
last | One past the end of the range. |
count | The number of elements to copy out of the range. |
cmp | The comparison function to use. |
Definition at line 1203 of file algorithm.h.
|
constexpr |
Returns a container of the greatest count elements according to cmp of the range [first, last), in arbitrary order. This overload works for linear containers.
Returns a container of the greatest count elements according to cmp of the range [first, last). This overload works for set-like types.
This function is included because its performance is sometimes better than the new version, and additionally, it does not rely on default-constructibility for the value type.
first | The beginning of the range. |
last | One past the end of the range. |
count | The number of elements to copy out of the range. |
cmp | The comparison function to use. |
This function is included because its performance is sometimes better than the new version, and additionally, it does not rely on default-constructibility for the value type.
first | The beginning of the range. |
first | One past the end of the range. |
count | The number of elements to copy out of the range. |
cmp | The comparison function to use. |
Definition at line 1146 of file algorithm.h.
|
constexpr |
Definition at line 57 of file containers.h.
|
inline |
auto kblib::html_encode | ( | const string & | data | ) | -> std::string |
|
constexpr |
|
constexpr |
|
constexprnoexcept |
Create a range from an iterator pair. Primarily useful for range-for loops.
begin,end | The range to wrap. |
Definition at line 1060 of file iterators.h.
kblib::indirect_range | ( | Iter1 | , |
Iter2 | |||
) | -> indirect_range< Iter1, Iter2 > |
|
constexprnoexcept |
In-place insertion sort. As is usual, it is stable. Provides as a guarantee that it will perform no moves on sorted input.
begin,end | The range to sort |
compare | The comparison predicate |
|
constexprnoexcept |
Out-of-place insertion sort, which does not modify the input. Provides as a guarantee that it will perform no moves on sorted input.
begin,end | The input range |
d_begin,d_end | The output range |
compare | The comparison predicate |
|
constexprnoexcept |
|
constexprnoexcept |
Definition at line 1575 of file algorithm.h.
|
constexprnoexcept |
Definition at line 1587 of file algorithm.h.
|
constexprnoexcept |
|
constexpr |
Definition at line 660 of file iterators.h.
|
constexpr |
|
inlineconstexpr |
Definition at line 343 of file stringops.h.
|
inlineconstexpr |
Definition at line 351 of file stringops.h.
|
inline |
Definition at line 331 of file stringops.h.
|
inline |
Definition at line 334 of file stringops.h.
auto kblib::join | ( | const range & | in, |
const string & | joiner = "" |
||
) |
Concatenates all elements of a range together with an optional joiner.
range must support iteration and be supported by fakestd::size().
in | A sequence of strings to concatenate. |
joiner | A string which will be inserted between every element of in. |
Definition at line 370 of file stringops.h.
auto kblib::kbsplit2 | ( | const String & | in, |
char | delim = ' ' |
||
) | -> Container |
Definition at line 477 of file stringops.h.
|
constexprnoexcept |
Definition at line 234 of file stringops.h.
auto kblib::lexical_cast | ( | const From & | val, |
const char * | type = typeid(To).name() |
||
) | -> To |
auto kblib::lexical_coerce | ( | const std::variant< Ts... > & | v | ) | -> To |
|
constexpr |
auto kblib::magic_enumerate | ( | It | begin, |
EIt | end | ||
) | -> enumerator_t<It, EIt> |
Allow access to indexes while using range-based for loops.
The "magic" part is that
captures 'val' by reference, while
captures 'val' by value, so that the effect is similar to if you had written
and kept track of the index manually.
begin,end | The input range. |
Definition at line 989 of file iterators.h.
auto kblib::magic_enumerate | ( | Range && | r | ) | -> auto |
Allow access to indexes while using range-based for loops. Safe to use with rvalues.
The "magic" part is that
captures 'val' by reference, while
captures 'val' by value, so that the effect is similar to if you had written
and kept track of the index manually.
r | A range to iterate over. |
Definition at line 1014 of file iterators.h.
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
constexprnoexcept |
Generates the first N values of the fibonacci sequence.
|
noexcept |
Factory function to make transform_iterators.
it | An InputIterator to a range to transform. |
op | The transformation to apply. |
Definition at line 1298 of file iterators.h.
|
noexcept |
auto kblib::max_count_digits | ( | ForwardIt | first, |
ForwardIt | last | ||
) | -> int |
auto kblib::max_count_digits | ( | ForwardIt | first, |
ForwardIt | last, | ||
int | base | ||
) | -> int |
Returns the necessary number of digits to represent the largest value in an input range.
first | The beginning of the input range. |
last | The end of the input range. |
base | The base to be used for calculation. |
auto kblib::max_element | ( | Container & | c, |
Comp | comp | ||
) | -> value_type_linear_t<Container>* |
Definition at line 78 of file iterators.h.
|
constexpr |
Definition at line 1109 of file algorithm.h.
|
inlineconstexprnoexcept |
|
inlinenoexcept |
auto kblib::nl | ( | std::basic_istream< CharT, Traits > & | is | ) | -> std::basic_istream<CharT, Traits>& |
Read in spaces until the end of the line is found.
nl may be used to consume whitespace left over after a formatted input operation before doing an unformatted input operation (such as std::getline).
is | The stream to read from. |
|
constexpr |
Determine if pred is false for every element of the range.
Definition at line 997 of file algorithm.h.
|
constexpr |
Determine if pred is true for every element of the range.
Definition at line 1011 of file algorithm.h.
|
inline |
Does nothing; matches the copy construction signature.
Definition at line 247 of file poly_obj.h.
|
inlinenoexcept |
Does nothing; matches the move construction signature.
Definition at line 252 of file poly_obj.h.
|
constexprnoexcept |
Definition at line 54 of file poly_obj.h.
|
constexprnoexcept |
Definition at line 60 of file poly_obj.h.
|
constexprnoexcept |
Definition at line 553 of file iterators.h.
|
constexpr |
Decrements val.
Definition at line 606 of file iterators.h.
|
constexpr |
Increments val.
Definition at line 581 of file iterators.h.
std::basic_ostream< CharT, Tr > & kblib::operator<< | ( | std::basic_ostream< CharT, Tr > & | is, |
get_manip< F > | func | ||
) |
std::basic_istream< CharT, Tr > & kblib::operator>> | ( | std::basic_istream< CharT, Tr > & | is, |
get_manip< F > | func | ||
) |
|
constexprnoexcept |
Definition at line 48 of file poly_obj.h.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
Definition at line 1084 of file poly_obj.h.
|
inlineconstexpr |
Definition at line 1091 of file poly_obj.h.
|
constexpr |
Definition at line 50 of file containers.h.
|
constexprnoexcept |
Quantize a real-valued value into a discrete integer.
T | An unsigned integral type. |
min | The real value corresponding to min in the output. |
max | The real value corresponding to max in the output. |
val | The input value. |
|
constexprnoexcept |
Quantize a real-valued value into a discrete integer.
TODO(killerbee13): write tests and fix style issues for quantization functions
T | An unsigned integral type. |
min | The real value corresponding to 0 in the output. |
delta | The difference between quantization steps. |
val | The input value. |
auto kblib::quoted | ( | character | c | ) | -> std::string |
auto kblib::quoted | ( | string && | in | ) | -> std::string |
|
constexpr |
Constructs a half-open range [0, max). The step is automatically determined based on the sign of max.
max | The first value not in the produced range. |
Definition at line 642 of file iterators.h.
|
constexpr |
Constructs a range from beginning, end, and step amount. The range is half-open, that is min is in the range but max is not. If unspecified, the step is automatically either 1 or -1, depending on whether max > min.
min | The first value in the produced range. |
max | The first value not in the produced range. |
step | The difference between values in the produced range. |
Definition at line 621 of file iterators.h.
|
constexpr |
Creates an array of only the meaningful characters in a string literal, and not the null terminator.
arr | A string literal to strip the null terminator from. |
|
inline |
Construct a string consisting of count copies of val.
This function is a trivial wrapper around a constructor of std::string provided for symmetry with the above overload.
val | The character to be repeated. |
count | The number of times to repeat val. |
Definition at line 642 of file stringops.h.
|
constexprnoexcept |
Invoke a function N times.
N | The number of times to invoke func. |
func | The function to invoke. |
Definition at line 53 of file algorithm.h.
auto kblib::repeat | ( | string | val, |
std::size_t | count | ||
) | -> string |
Construct a string consisting of count copies of val concatenated together.
This function currently works greedily and will be inefficient for large values of count.
val | |
count |
Definition at line 625 of file stringops.h.
|
constexpr |
Copies an input range, but every element for which pred is true is replaced by new_value. It also allows for a sentinel end iterator.
constexpr
in C++14.first | The beginning of the input range. |
last | The end of the input range. |
out | The beginning of the output range. |
pred | The predicate to apply. |
new_value | The value to replace those elements for which pred is true with. |
Definition at line 1413 of file algorithm.h.
|
constexpr |
Copies an input range, but every element for which pred is true is replaced by new_value.
constexpr
in C++14.first | The beginning of the input range. |
count | The number of elements to copy. |
out | The beginning of the output range. |
pred | The predicate to apply. |
new_value | The value to replace those elements for which pred is true with. |
Definition at line 1444 of file algorithm.h.
auto kblib::reverse_str | ( | string | val | ) | -> string |
Reverses all the elements of its input.
val | The string to reverse. |
Definition at line 555 of file stringops.h.
|
constexpr |
|
constexprnoexcept |
Rotates the input range. This is just a constexpr-in-C++14 version of std::rotate.
first | |
n_first | |
last |
Definition at line 1509 of file algorithm.h.
auto kblib::safe_auto | ( | T && | in | ) | -> T |
auto kblib::safe_auto | ( | T & | in | ) | -> T& |
|
constexprnoexcept |
auto kblib::scoped_file | ( | const std::filesystem::path & | path, |
std::ios_base::openmode | mode = std::ios_base::in | std::ios_base::out |
||
) |
|
constexpr |
Definition at line 1462 of file algorithm.h.
|
constexpr |
Definition at line 1487 of file algorithm.h.
auto kblib::seeded | ( | Source && | s | ) | -> Gen |
|
constexpr |
|
constexprnoexcept |
|
constexpr |
|
constexprnoexcept |
|
constexpr |
|
constexpr |
Sorts a range.
Complexity: worst-case O(N log(N)), where N = std::distance(begin, end) comparisons and swaps.
begin,end | The range to sort |
compare | A comparison predicate which returns true if the first argument shall be ordered before the second. BinaryPredicate must meet the requirements of the Compare named requirement. |
|
constexpr |
|
constexpr |
Sorts a range after applying a transformation.
Complexity: worst-case O(N log(N)), where N = std::distance(begin, end) comparisons and swaps.
begin,end | The range to sort |
transform | A transformer (such as unary function or pointer to member) which will be applied to each object before comparing it. A transformer may not modify the object it is called with. |
compare | A comparison predicate which returns true if the first argument shall be ordered before the second. BinaryPredicate must meet the requirements of the Compare named requirement. |
auto kblib::split_dsv | ( | const String & | str, |
char | delim | ||
) | -> Container |
Split a string on all instances of delim.
in | The string to split |
delim | The character to split on. |
Definition at line 504 of file stringops.h.
auto kblib::split_dsv | ( | const String & | str, |
Predicate | delim | ||
) | -> return_assert_t< is_callable<Predicate, typename Container::value_type::value_type>::value, Container> |
Split a string on all instances of delim.
in | The string to split |
delim | A predicate for delimiters. |
Definition at line 525 of file stringops.h.
auto kblib::split_tokens | ( | const String & | in | ) | -> Container |
Split a string on all instances of whitespace.
in | The string to split |
Definition at line 436 of file stringops.h.
auto kblib::split_tokens | ( | const String & | in, |
Predicate | spacer | ||
) | -> return_assert_t< is_callable<Predicate, typename Container::value_type::value_type>::value, Container> |
Split a string on all condensed delimiters.
in | The string to split |
spacer | A predicate which determines whether a character is a delimiter. |
Definition at line 397 of file stringops.h.
auto kblib::split_tokens | ( | const String & | in, |
typename Container::value_type::value_type | delim | ||
) | -> Container |
Split a string on all instances of a delimiter.
in | The string to split |
delim | The character to split on. A run of delimiters is condensed. |
Definition at line 448 of file stringops.h.
|
constexpr |
Checks if a given range starts with a particular subrange.
Definition at line 738 of file algorithm.h.
|
constexpr |
Checks if a given range starts with a particular subrange.
Definition at line 759 of file algorithm.h.
|
inline |
Checks if a given string starts with a particular string.
haystack | The string to be checked. |
needle | The prefix to check for. |
Definition at line 691 of file stringops.h.
|
inline |
Checks if a given string starts with a particular string.
haystack | The string to be checked. |
needle | The prefix to check for. |
Definition at line 679 of file stringops.h.
auto kblib::static_coerce | ( | const std::variant< Ts... > & | v | ) | -> To |
auto kblib::strsize | ( | Str && | str | ) | -> std::size_t |
Determines the size in characters of any valid argument to concat or append.
str | A value of any stringlike or arithmetic type to count the characters of. |
Definition at line 217 of file stringops.h.
|
constexpr |
Sum a range.
Convenience wrapper for std::accumulate. For an empty range, returns a value-initialized temporary (usually 0). Deduces the correct type for the initializer, which reduces risk of truncation and incorrect results.
[in] | first | Beginning of range |
[in] | last | End of range |
Definition at line 194 of file algorithm.h.
|
constexpr |
Fold a range over an operation.
Convenience wrapper for std::accumulate. For an empty range, returns a value-initialized temporary (usually 0). Deduces the correct type for the initializer, which reduces risk of truncation and incorrect results.
[in] | first | Beginning of range |
[in] | last | End of range |
[in] | op | The fold operation |
Definition at line 216 of file algorithm.h.
|
constexpr |
Sum a range.
Convenience wrapper for std::accumulate. For an empty range, returns a value-initialized temporary (usually 0). Deduces the correct type for the initializer, which reduces risk of truncation and incorrect results.
[in] | r | The range to sum |
Definition at line 237 of file algorithm.h.
|
constexpr |
auto kblib::tee | ( | StreamA & | a, |
StreamB & | b | ||
) | -> basic_teestream<StreamA, StreamB> |
auto kblib::time_to_str | ( | std::chrono::time_point< clock, duration > & | tp, |
const std::string & | fmt = "%F %T" |
||
) | -> std::string |
auto kblib::tmpfile | ( | const std::filesystem::path & | path, |
std::ios_base::openmode | mode = std::ios_base::in | std::ios_base::out |
||
) |
|
constexprnoexcept |
|
constexprnoexcept |
|
constexprnoexcept |
|
constexprnoexcept |
Gets a raw pointer out of any smart pointer or iterator you might pass in, without dereferencing it or relying on a get() method.
p | A smart pointer to extract from. |
Definition at line 72 of file iterators.h.
|
constexpr |
auto kblib::to_string | ( | Int | num | ) | -> std::string |
auto kblib::to_string | ( | Int | num, |
int | base | ||
) | -> std::string |
auto kblib::to_unique | ( | owner< T * > | p | ) | -> std::unique_ptr<T> |
auto kblib::to_unique | ( | owner< T * > | p, |
D && | d | ||
) | -> std::unique_ptr<T, D> |
|
constexpr |
|
constexpr |
Folds all characters in a string using the default execution character set to lowercase.
str | The string to case-fold. |
Definition at line 594 of file stringops.h.
|
inline |
auto kblib::toStr | ( | T | val | ) | -> std::string |
auto kblib::toupper | ( | string | str | ) | -> string |
Folds all characters in a string using the default execution character set to uppercase.
str | The string to case-fold. |
Definition at line 607 of file stringops.h.
auto kblib::toUTF32 | ( | const icu::UnicodeString & | s | ) | -> string |
auto kblib::toUTF8 | ( | const icu::UnicodeString & | s | ) | -> string |
|
constexpr |
transform applies the given function to a range and stores the result in another range, beginning at d_first. The unary operation unary_op is applied to the range defined by [first1, last1). It also allows for a sentinel end iterator.
*d_first = kblib::invoke(binary_op, *first, *first2)
must be valid and must not modify *first
or *first2
.first | The beginning of the first input range |
last | The end of the first input range |
first2 | The beginning of the second input range |
d_first | The beginning of the output range |
binary_op | The operation to apply |
Definition at line 1659 of file algorithm.h.
|
constexpr |
transform applies the given function to a range and stores the result in another range, beginning at d_first. The unary operation unary_op is applied to the range defined by [first1, last1). It also allows for a sentinel end iterator.
*d_first = kblib::invoke(unary_op, *first)
must be valid and must not modify *first
.first | The beginning of the input range |
last | The end of the input range |
d_first | The beginning of the output range |
unary_op | The operation to apply |
Definition at line 1632 of file algorithm.h.
|
constexpr |
Definition at line 251 of file algorithm.h.
|
constexpr |
transform applies the given function to a range and stores the result in another range, beginning at d_first. The unary operation unary_op is applied to the range defined by [first1, last1). It also allows for a sentinel end iterator.
kblib::invoke(pred, *first)
must be valid and must return a type convertible to bool
, and must not modify *first
*d_first = kblib::invoke(unary_op, *first)
must be valid and must not modify *first
.first | The beginning of the input range |
last | The end of the input range |
d_first | The beginning of the output range |
pred | The predicate to apply |
unary_op | The operation to apply |
Definition at line 1690 of file algorithm.h.
kblib::transform_iterator | ( | It | , |
operation | |||
) | -> transform_iterator< It, operation > |
|
noexcept |
Definition at line 1321 of file iterators.h.
|
noexcept |
Factory function to make transform_iterators.
it | An InputIterator to a range to transform. |
op | The transformation to apply. |
Definition at line 1314 of file iterators.h.
|
constexpr |
|
constexpr |
Definition at line 67 of file containers.h.
auto kblib::try_get_file_contents | ( | const string & | filename | ) | -> D |
Read the entire contents of a file into a container, such as std::string or std::vector<char>. Note that it will be most efficient to read into contiguous containers, as opposed to non-contiguous containers.
filename | The filename to open. |
D | A contiguous sequence container, which will be created and filled with the contents of the file to be read. |
|
noexcept |
auto kblib::unformatted_expect | ( | CharT | c | ) | -> auto |
auto kblib::url_encode | ( | const string & | value | ) | -> std::string |
|
constexpr |
|
constexpr |
Wraps std::visit to provide an interface taking one variant and any number of functors providing an overload set.
Also moves the variant to the left side of the operation, improving readability.
v | The variant to visit over. |
fs | Any number of functors, which taken together as an overload set can be unambiguously called with any type in V. |
|
constexpr |
Two-step visiting interface. Takes a variant, and returns an object which can be called with any number of callable arguments, builds an overload set from them, and visits the variant.
v | A variant to visit. |
|
constexpr |
|
constexpr |
|
constexpr |
Visit a variant, but pass the index (as an integral_constant) to the visitor. This allows for a visitor of a variant with duplicated types to maintain index information.
variant | The variant to visit. |
fs | Any number of functors, which taken together as an overload set can be unambiguously called with (I, A), for I = kblib::constant<std::size_t, variant.index()> and A = std::get<variant.index()>(variant). Note that kblib::constant implicitly converts to std::integral_constant. |
kblib::visitor | ( | Ts... | ) | -> visitor< Ts... > |
|
noexcept |
Iterate over two ranges in lockstep, like Python's zip.
InputIt1 and EndIt may be different types, however that breaks range-for in C++14.
begin1,end1 | The first range. |
begin2 | The beginning of the second range. |
Definition at line 1454 of file iterators.h.
|
noexcept |
Iterate over two ranges in lockstep, like Python's zip.
r1 | The first range. |
r2 | The second range. |
Definition at line 1470 of file iterators.h.
|
constexpr |
|
constexpr |
constexpr struct kblib::build_end_t kblib::build_end |
|
inlineconstexpr |
KBLIB_CONSTANT_V kblib::contains_type_v = contains_type<Ts...>::value |
KBLIB_CONSTANT_V kblib::contains_types_v = contains_types<Ts...>::value |
KBLIB_CONSTANT auto kblib::eof = std::char_traits<CharT>::eof() |
KBLIB_CONSTANT_V kblib::has_reserve_v = false |
|
constexpr |
|
constexpr |
|
inlineconstexpr |
constexpr struct kblib::in_place_agg_t kblib::in_place_agg |
KBLIB_CONSTANT_V kblib::is_aliasing_type_v = is_aliasing_type<T>::value |
KBLIB_CONSTANT_V kblib::is_bidirectional_iterator_v = is_bidirectional_iterator<T>::value |
|
constexpr |
|
constexpr |
Equivalent to is_character<C>::value.
Definition at line 76 of file stringops.h.
KBLIB_CONSTANT_V kblib::is_contiguous_v = false |
KBLIB_CONSTANT_V kblib::is_forward_iterator_v = is_forward_iterator<T>::value |
KBLIB_CONSTANT_V kblib::is_hashable_v = is_hashable<Key>::value |
KBLIB_CONSTANT_V kblib::is_input_iterator_v = is_input_iterator<T>::value |
KBLIB_CONSTANT_V kblib::is_iterable_v = is_iterable<T>::value |
KBLIB_CONSTANT_V kblib::is_iterator_v = is_iterator<T>::value |
|
constexpr |
KBLIB_CONSTANT_V kblib::is_random_access_iterator_v = is_random_access_iterator<T>::value |
KBLIB_CONSTANT_V kblib::is_reference_v = std::is_reference<T>::value |
KBLIB_CONSTANT_V kblib::is_resizable_v = decltype(detail::calc_resizable<C>(0))::value |
KBLIB_CONSTANT_V kblib::is_trivially_hashable_v |
|
inlineconstexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
inlineconstexpr |
|
constexpr |
|
constexpr |
struct { ... } kblib::swap |
|
constexpr |
|
constexpr |