tlx
tlx Namespace Reference

Namespaces

 digest_detail
 
 meta_detail
 
 multisequence_partition_detail
 
 multisequence_selection_detail
 
 multiway_merge_detail
 
 parallel_mergesort_detail
 
 radix_heap_detail
 
 sort_strings_detail
 

Classes

class  Aggregate
 Calculate running aggregate statistics: feed it with values, and it will keep the minimum, the maximum, the average, the value number, and the standard deviation is values. More...
 
class  AggregateMinMax
 Calculate running aggregate statistics: feed it with values, and it will keep the minimum and the maximum values. More...
 
class  AllocatorBase
 
class  BTree
 Basic class implementing a B+ tree data structure in memory. More...
 
struct  btree_default_traits
 Generates default traits for a B+ tree used as a set or map. More...
 
class  btree_map
 Specialized B+ tree template class implementing STL's map container. More...
 
class  btree_multimap
 Specialized B+ tree template class implementing STL's multimap container. More...
 
class  btree_multiset
 Specialized B+ tree template class implementing STL's multiset container. More...
 
class  btree_set
 Specialized B+ tree template class implementing STL's set container. More...
 
class  CmdlineParser
 Command line parser which automatically fills variables and prints nice usage messages. More...
 
class  CountingPtr
 High-performance smart pointer used as a wrapping reference counting pointer. More...
 
class  CountingPtrDefaultDeleter
 default deleter for CountingPtr More...
 
class  CountingPtrNoOperationDeleter
 dummy deleter for CountingPtr More...
 
class  DAryAddressableIntHeap
 This class implements an addressable integer priority queue, precisely a d-ary heap. More...
 
class  DAryHeap
 This class implements a d-ary comparison-based heap usable as a priority queue. More...
 
class  DefaultLoggerOutputCErr
 default output logger to cerr More...
 
class  DefaultLoggerOutputCOut
 default output logger to cout More...
 
class  Delegate
 
class  Delegate< R(A...), Allocator >
 This is a faster replacement than std::function. More...
 
class  DieException
 Exception thrown by die_with_message() if. More...
 
struct  enable_if
 SFINAE enable_if – copy of std::enable_if<> with less extra cruft. More...
 
struct  enable_if< true, T >
 
class  FunctionChain
 A FunctionChain is a chain of functors that can be folded to a single functors. More...
 
class  FunctionStack
 A FunctionStack is a chain of functor that can be folded to a single functor (which is usually optimize by the compiler). More...
 
struct  index_sequence
 
struct  is_std_array
 test if is std::array<T, N> More...
 
struct  is_std_array< std::array< T, N > >
 
struct  is_std_pair
 test if is a std::pair<...> More...
 
struct  is_std_pair< std::pair< S, T > >
 
struct  is_std_tuple
 test if is a std::tuple<...> More...
 
struct  is_std_tuple< std::tuple< Ts... > >
 
struct  is_std_vector
 test if is std::vector<T> More...
 
struct  is_std_vector< std::vector< T > >
 
struct  less_icase_asc
 Case-insensitive less order relation functional class for std::map, etc. More...
 
struct  less_icase_desc
 Descending case-insensitive less order relation functional class for std::map, etc. More...
 
struct  LevenshteinStandardICaseParameters
 Standard parameters to Levenshtein distance function. More...
 
struct  LevenshteinStandardParameters
 Standard parameters to levenshtein distance function. More...
 
class  Log2
 
class  Log2< 0 >
 
class  Log2< 1 >
 
class  Log2Floor
 
class  Log2Floor< 0 >
 
class  Log2Floor< 1 >
 
class  Logger
 LOG and sLOG for development and debugging. More...
 
class  LoggerCollectOutput
 Class to hook logger output in the local thread. More...
 
class  LoggerFormatter
 template class for formatting. contains a print() method. More...
 
class  LoggerFormatter< AnyType >
 
class  LoggerFormatter< std::array< T, N > >
 
class  LoggerFormatter< std::deque< T, A > >
 
class  LoggerFormatter< std::map< K, V, C, A > >
 
class  LoggerFormatter< std::multimap< K, V, C, A > >
 
class  LoggerFormatter< std::multiset< T, C, A > >
 
class  LoggerFormatter< std::pair< A, B > >
 
class  LoggerFormatter< std::set< T, C, A > >
 
class  LoggerFormatter< std::tuple< Args... > >
 
class  LoggerFormatter< std::tuple<> >
 
class  LoggerFormatter< std::unordered_map< K, V, H, E, A > >
 
class  LoggerFormatter< std::unordered_multimap< K, V, H, E, A > >
 
class  LoggerFormatter< std::unordered_multiset< T, H, E, A > >
 
class  LoggerFormatter< std::unordered_set< T, H, E, A > >
 
class  LoggerFormatter< std::vector< T, A > >
 
class  LoggerOutputHook
 Abstract class to implement output hooks for logging. More...
 
class  LoggerPrefixHook
 Abstract class to implement prefix output hooks for logging. More...
 
class  LoggerTupleFormatter
 
class  LoggerVoidify
 
class  LoserTreeCopy
 Guarded loser tree/tournament tree, either copying the whole element into the tree structure, or looking up the element via the index. More...
 
class  LoserTreeCopy< true, ValueType, Comparator >
 Guarded loser tree/tournament tree, either copying the whole element into the tree structure, or looking up the element via the index. More...
 
class  LoserTreeCopyBase
 Guarded loser tree/tournament tree, either copying the whole element into the tree structure, or looking up the element via the index. More...
 
class  LoserTreeCopyUnguarded
 
class  LoserTreeCopyUnguarded< true, ValueType, Comparator >
 
class  LoserTreeCopyUnguardedBase
 Unguarded loser tree, copying the whole element into the tree structure. More...
 
class  LoserTreePointer
 Guarded loser tree, using pointers to the elements instead of copying them into the tree nodes. More...
 
class  LoserTreePointer< true, ValueType, Comparator >
 Guarded loser tree, using pointers to the elements instead of copying them into the tree nodes. More...
 
class  LoserTreePointerBase
 Guarded loser tree, using pointers to the elements instead of copying them into the tree nodes. More...
 
class  LoserTreePointerUnguarded
 
class  LoserTreePointerUnguarded< true, ValueType, Comparator >
 
class  LoserTreePointerUnguardedBase
 Unguarded loser tree, keeping only pointers to the elements in the tree structure. More...
 
class  LoserTreeSwitch
 
class  LruCacheMap
 This is an expected O(1) LRU cache which contains a map of (key -> value) elements. More...
 
class  LruCacheSet
 This is an expected O(1) LRU cache which contains a set of key-only elements. More...
 
struct  make_index_sequence
 
class  MD5
 MD-5 processor without external dependencies. More...
 
class  MultiTimer
 MultiTimer can be used to measure time usage of different phases in a program or algorithm. More...
 
class  NoOperation
 The noop functor, which takes any arguments and does nothing. More...
 
class  NoOperation< void >
 Specialized noop functor which returns a void. More...
 
class  PolynomialRegression
 Calculate the regression polynomial \( a_0+a_1x^1+a_2x^2+\cdots+a_nx^n \) from a list of 2D points. More...
 
class  RadixHeap
 This class implements a monotonic integer min priority queue, more specific a multi-level radix heap. More...
 
class  ReferenceCounter
 Provides reference counting abilities for use with CountingPtr. More...
 
class  RingBuffer
 A ring (circular) buffer of static (non-growing) size. More...
 
class  ScopedMultiTimer
 Independent RAII Scoped MultiTimer: contains a MultiTimer which is started with the given timer, and added to the base MultiTimer on destruction. More...
 
class  ScopedMultiTimerSwitch
 RAII Scoped MultiTimer switcher: switches the timer of a MultiTimer on construction and back to old one on destruction. More...
 
class  Semaphore
 A simple semaphore implementation using C++11 synchronization methods. More...
 
class  SHA1
 SHA-1 processor without external dependencies. More...
 
class  SHA256
 SHA-256 processor without external dependencies. More...
 
class  SHA512
 SHA-512 processor without external dependencies. More...
 
class  SimpleVector
 Simpler non-growing vector without initialization. More...
 
class  SpacingLogger
 A logging class which outputs spaces between elements pushed via operator<<. More...
 
class  SplayTree
 
class  StackAllocator
 
class  StackArena
 Storage area allocated on the stack and usable by a StackAllocator. More...
 
struct  StaticIndex
 Helper for call_foreach_with_index() to save the index as a compile-time index. More...
 
class  StringView
 StringView is a reference to a part of a string, consisting of only a char pointer and a length. More...
 
class  ThreadBarrierMutex
 Implements a thread barrier using mutex locking and condition variables that can be used to synchronize threads. More...
 
class  ThreadBarrierSpin
 Implements a thread barrier using atomics and a spin lock that can be used to synchronize threads. More...
 
class  ThreadPool
 ThreadPool starts a fixed number p of std::threads which process Jobs that are enqueued into a concurrent job queue. More...
 

Typedefs

template<typename KeyType , unsigned Arity = 2, typename Compare = std::less<KeyType>>
using d_ary_addressable_int_heap = DAryAddressableIntHeap< KeyType, Arity, Compare >
 make template alias due to similarity with std::priority_queue More...
 
template<typename KeyType , unsigned Arity = 2, typename Compare = std::less<KeyType>>
using d_ary_heap = DAryHeap< KeyType, Arity, Compare >
 make template alias due to similarity with std::priority_queue More...
 
template<typename KeyType , typename DataType , unsigned Radix = 8>
using RadixHeapPair = RadixHeap< std::pair< KeyType, DataType >, radix_heap_detail::PairKeyExtract< KeyType, DataType >, KeyType, Radix >
 This class is a variant of tlx::RadixHeap for data types which do not include the key directly. More...
 
template<typename T >
using simple_vector = SimpleVector< T >
 make template alias due to similarity with std::vector More...
 
template<typename Key , typename Compare = std::less<Key>, typename Allocator = std::allocator<Key>>
using splay_set = SplayTree< Key, Compare, false, Allocator >
 
template<typename Key , typename Compare = std::less<Key>, typename Allocator = std::allocator<Key>>
using splay_multiset = SplayTree< Key, Compare, true, Allocator >
 
using string_view = StringView
 make alias due to STL similarity More...
 
template<typename Type >
using counting_ptr = CountingPtr< Type >
 make alias due to similarity with std::shared_ptr<T> More...
 
template<typename Type >
using CountingPtrNoDelete = CountingPtr< Type, CountingPtrNoOperationDeleter >
 make alias for dummy deleter More...
 
using reference_counter = ReferenceCounter
 make alias due to CountingPtr's similarity with std::shared_ptr<T> More...
 
template<typename T , typename Allocator = std::allocator<void>>
using delegate = Delegate< T, Allocator >
 make template alias due to similarity with std::function More...
 
typedef uint32_t u32
 
typedef uint64_t u64
 
using semaphore = Semaphore
 alias for STL-like code style More...
 

Enumerations

enum  MultiwayMergeAlgorithm {
  MWMA_LOSER_TREE, MWMA_LOSER_TREE_COMBINED, MWMA_LOSER_TREE_SENTINEL, MWMA_BUBBLE,
  MWMA_ALGORITHM_LAST, MWMA_ALGORITHM_DEFAULT
}
 Different merging algorithms: bubblesort-alike, loser-tree variants, enum sentinel. More...
 
enum  MultiwayMergeSplittingAlgorithm { MWMSA_SAMPLING, MWMSA_EXACT, MWMSA_LAST, MWMSA_DEFAULT }
 Different splitting strategies for sorting/merging: by sampling, exact. More...
 
enum  SimpleVectorMode { Normal, NoInitButDestroy, NoInitNoDestroy }
 enum class to select SimpleVector object initialization More...
 

Functions

template<typename InputIterator , typename OutputIterator , typename T , typename BinaryOperation = std::plus<T>>
OutputIterator exclusive_scan (InputIterator first, InputIterator last, OutputIterator result, T init, BinaryOperation binary_op=BinaryOperation())
 Computes an exclusive prefix sum operation using binary_op the range [first, last), using init as the initial value, and writes the results to the range beginning at result. More...
 
template<typename ForwardIterator , typename Comparator >
ForwardIterator is_sorted_until_cmp (ForwardIterator first, ForwardIterator last, Comparator cmp)
 Checks if a range is sorted using a three-way Comparator (with memcmp() semantics). More...
 
template<typename ForwardIterator , typename Comparator >
bool is_sorted_cmp (ForwardIterator first, ForwardIterator last, Comparator cmp)
 Checks if a range is sorted using a three-way Comparator (with memcmp() semantics). More...
 
template<typename RandomAccessIterator1 , typename RandomAccessIterator2 , typename OutputIterator , typename DiffType , typename Comparator >
OutputIterator merge_advance_usual (RandomAccessIterator1 &begin1, RandomAccessIterator1 end1, RandomAccessIterator2 &begin2, RandomAccessIterator2 end2, OutputIterator target, DiffType max_size, Comparator comp)
 Merge routine being able to merge only the max_size smallest elements. More...
 
template<typename RandomAccessIterator1 , typename RandomAccessIterator2 , typename OutputIterator , typename DiffType , typename Comparator >
OutputIterator merge_advance_movc (RandomAccessIterator1 &begin1, RandomAccessIterator1 end1, RandomAccessIterator2 &begin2, RandomAccessIterator2 end2, OutputIterator target, DiffType max_size, Comparator comp)
 Merge routine being able to merge only the max_size smallest elements. More...
 
template<typename RandomAccessIterator1 , typename RandomAccessIterator2 , typename OutputIterator , typename DiffType , typename Comparator >
OutputIterator merge_advance (RandomAccessIterator1 &begin1, RandomAccessIterator1 end1, RandomAccessIterator2 &begin2, RandomAccessIterator2 end2, OutputIterator target, DiffType max_size, Comparator comp)
 Merge routine being able to merge only the max_size smallest elements. More...
 
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename Comparator , typename Combine = std::plus< typename std::iterator_traits<InputIterator1>::value_type>>
OutputIterator merge_combine (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Comparator cmp=Comparator(), Combine combine=Combine())
 Merge two sorted ranges and add all items comparing equal. More...
 
template<typename RanSeqs , typename RankType , typename RankIterator , typename Comparator = std::less< typename std::iterator_traits< typename std::iterator_traits<RanSeqs> ::value_type::first_type>::value_type>>
void multisequence_partition (const RanSeqs &begin_seqs, const RanSeqs &end_seqs, const RankType &rank, RankIterator begin_offsets, Comparator comp=Comparator())
 Splits several sorted sequences at a certain global rank, resulting in a splitting point for each sequence. More...
 
template<typename ValueType , typename RanSeqs , typename RankType , typename Comparator = std::less<ValueType>>
ValueType multisequence_selection (const RanSeqs &begin_seqs, const RanSeqs &end_seqs, const RankType &rank, RankType &offset, Comparator comp=Comparator())
 Selects the element at a certain global rank from several sorted sequences. More...
 
template<bool Stable, bool Sentinels, typename RandomAccessIteratorIterator , typename RandomAccessIterator3 , typename Comparator = std::less< typename std::iterator_traits< typename std::iterator_traits<RandomAccessIteratorIterator> ::value_type::first_type>::value_type>>
RandomAccessIterator3 multiway_merge_base (RandomAccessIteratorIterator seqs_begin, RandomAccessIteratorIterator seqs_end, RandomAccessIterator3 target, typename std::iterator_traits< typename std::iterator_traits< RandomAccessIteratorIterator >::value_type::first_type >::difference_type size, Comparator comp=Comparator(), MultiwayMergeAlgorithm mwma=MWMA_ALGORITHM_DEFAULT)
 Sequential multi-way merging switch. More...
 
template<typename RandomAccessIteratorIterator , typename RandomAccessIterator3 , typename Comparator = std::less< typename std::iterator_traits< typename std::iterator_traits<RandomAccessIteratorIterator> ::value_type::first_type>::value_type>>
RandomAccessIterator3 multiway_merge (RandomAccessIteratorIterator seqs_begin, RandomAccessIteratorIterator seqs_end, RandomAccessIterator3 target, typename std::iterator_traits< typename std::iterator_traits< RandomAccessIteratorIterator >::value_type::first_type >::difference_type size, Comparator comp=Comparator(), MultiwayMergeAlgorithm mwma=MWMA_ALGORITHM_DEFAULT)
 Sequential multi-way merge. More...
 
template<typename RandomAccessIteratorIterator , typename RandomAccessIterator3 , typename Comparator = std::less< typename std::iterator_traits< typename std::iterator_traits<RandomAccessIteratorIterator> ::value_type::first_type>::value_type>>
RandomAccessIterator3 stable_multiway_merge (RandomAccessIteratorIterator seqs_begin, RandomAccessIteratorIterator seqs_end, RandomAccessIterator3 target, typename std::iterator_traits< typename std::iterator_traits< RandomAccessIteratorIterator >::value_type::first_type >::difference_type size, Comparator comp=Comparator(), MultiwayMergeAlgorithm mwma=MWMA_ALGORITHM_DEFAULT)
 Stable sequential multi-way merge. More...
 
template<typename RandomAccessIteratorIterator , typename RandomAccessIterator3 , typename Comparator = std::less< typename std::iterator_traits< typename std::iterator_traits<RandomAccessIteratorIterator> ::value_type::first_type>::value_type>>
RandomAccessIterator3 multiway_merge_sentinels (RandomAccessIteratorIterator seqs_begin, RandomAccessIteratorIterator seqs_end, RandomAccessIterator3 target, typename std::iterator_traits< typename std::iterator_traits< RandomAccessIteratorIterator >::value_type::first_type >::difference_type size, Comparator comp=Comparator(), MultiwayMergeAlgorithm mwma=MWMA_ALGORITHM_DEFAULT)
 Sequential multi-way merge with sentinels in sequences. More...
 
template<typename RandomAccessIteratorIterator , typename RandomAccessIterator3 , typename Comparator = std::less< typename std::iterator_traits< typename std::iterator_traits<RandomAccessIteratorIterator> ::value_type::first_type>::value_type>>
RandomAccessIterator3 stable_multiway_merge_sentinels (RandomAccessIteratorIterator seqs_begin, RandomAccessIteratorIterator seqs_end, RandomAccessIterator3 target, typename std::iterator_traits< typename std::iterator_traits< RandomAccessIteratorIterator >::value_type::first_type >::difference_type size, Comparator comp=Comparator(), MultiwayMergeAlgorithm mwma=MWMA_ALGORITHM_DEFAULT)
 Stable sequential multi-way merge with sentinels in sequences. More...
 
template<bool Stable, typename RandomAccessIteratorIterator , typename Comparator >
void multiway_merge_sampling_splitting (const RandomAccessIteratorIterator &seqs_begin, const RandomAccessIteratorIterator &seqs_end, typename std::iterator_traits< typename std::iterator_traits< RandomAccessIteratorIterator >::value_type::first_type >::difference_type size, typename std::iterator_traits< typename std::iterator_traits< RandomAccessIteratorIterator >::value_type::first_type >::difference_type total_size, Comparator comp, std::vector< typename std::iterator_traits< RandomAccessIteratorIterator >::value_type > *chunks, const size_t num_threads, const size_t merge_oversampling)
 Splitting method for parallel multi-way merge routine: use sampling and binary search for in-exact splitting. More...
 
template<bool Stable, typename RandomAccessIteratorIterator , typename Comparator >
void multiway_merge_exact_splitting (const RandomAccessIteratorIterator &seqs_begin, const RandomAccessIteratorIterator &seqs_end, typename std::iterator_traits< typename std::iterator_traits< RandomAccessIteratorIterator >::value_type::first_type >::difference_type size, typename std::iterator_traits< typename std::iterator_traits< RandomAccessIteratorIterator >::value_type::first_type >::difference_type total_size, Comparator comp, std::vector< typename std::iterator_traits< RandomAccessIteratorIterator >::value_type > *chunks, const size_t num_threads)
 Splitting method for parallel multi-way merge routine: use multisequence selection for exact splitting. More...
 
template<bool Stable, typename RandomAccessIteratorIterator , typename RandomAccessIterator3 , typename Comparator = std::less< typename std::iterator_traits< typename std::iterator_traits<RandomAccessIteratorIterator> ::value_type::first_type>::value_type>>
RandomAccessIterator3 parallel_multiway_merge_base (RandomAccessIteratorIterator seqs_begin, RandomAccessIteratorIterator seqs_end, RandomAccessIterator3 target, const typename std::iterator_traits< typename std::iterator_traits< RandomAccessIteratorIterator >::value_type::first_type >::difference_type size, Comparator comp=Comparator(), MultiwayMergeAlgorithm mwma=MWMA_ALGORITHM_DEFAULT, MultiwayMergeSplittingAlgorithm mwmsa=MWMSA_DEFAULT, size_t num_threads=std::thread::hardware_concurrency())
 Parallel multi-way merge routine. More...
 
template<typename RandomAccessIteratorIterator , typename RandomAccessIterator3 , typename Comparator = std::less< typename std::iterator_traits< typename std::iterator_traits<RandomAccessIteratorIterator> ::value_type::first_type>::value_type>>
RandomAccessIterator3 parallel_multiway_merge (RandomAccessIteratorIterator seqs_begin, RandomAccessIteratorIterator seqs_end, RandomAccessIterator3 target, const typename std::iterator_traits< typename std::iterator_traits< RandomAccessIteratorIterator >::value_type::first_type >::difference_type size, Comparator comp=Comparator(), MultiwayMergeAlgorithm mwma=MWMA_ALGORITHM_DEFAULT, MultiwayMergeSplittingAlgorithm mwmsa=MWMSA_DEFAULT, size_t num_threads=std::thread::hardware_concurrency())
 Parallel multi-way merge routine. More...
 
template<typename RandomAccessIteratorIterator , typename RandomAccessIterator3 , typename Comparator = std::less< typename std::iterator_traits< typename std::iterator_traits<RandomAccessIteratorIterator> ::value_type::first_type>::value_type>>
RandomAccessIterator3 stable_parallel_multiway_merge (RandomAccessIteratorIterator seqs_begin, RandomAccessIteratorIterator seqs_end, RandomAccessIterator3 target, const typename std::iterator_traits< typename std::iterator_traits< RandomAccessIteratorIterator >::value_type::first_type >::difference_type size, Comparator comp=Comparator(), MultiwayMergeAlgorithm mwma=MWMA_ALGORITHM_DEFAULT, MultiwayMergeSplittingAlgorithm mwmsa=MWMSA_DEFAULT, size_t num_threads=std::thread::hardware_concurrency())
 Stable parallel multi-way merge routine. More...
 
template<typename RandomAccessIteratorIterator , typename RandomAccessIterator3 , typename Comparator = std::less< typename std::iterator_traits< typename std::iterator_traits<RandomAccessIteratorIterator> ::value_type::first_type>::value_type>>
RandomAccessIterator3 parallel_multiway_merge_sentinels (RandomAccessIteratorIterator seqs_begin, RandomAccessIteratorIterator seqs_end, RandomAccessIterator3 target, const typename std::iterator_traits< typename std::iterator_traits< RandomAccessIteratorIterator >::value_type::first_type >::difference_type size, Comparator comp=Comparator(), MultiwayMergeAlgorithm mwma=MWMA_ALGORITHM_DEFAULT, MultiwayMergeSplittingAlgorithm mwmsa=MWMSA_DEFAULT, size_t num_threads=std::thread::hardware_concurrency())
 Parallel multi-way merge routine with sentinels. More...
 
template<typename RandomAccessIteratorIterator , typename RandomAccessIterator3 , typename Comparator = std::less< typename std::iterator_traits< typename std::iterator_traits<RandomAccessIteratorIterator> ::value_type::first_type>::value_type>>
RandomAccessIterator3 stable_parallel_multiway_merge_sentinels (RandomAccessIteratorIterator seqs_begin, RandomAccessIteratorIterator seqs_end, RandomAccessIterator3 target, const typename std::iterator_traits< typename std::iterator_traits< RandomAccessIteratorIterator >::value_type::first_type >::difference_type size, Comparator comp=Comparator(), MultiwayMergeAlgorithm mwma=MWMA_ALGORITHM_DEFAULT, MultiwayMergeSplittingAlgorithm mwmsa=MWMSA_DEFAULT, size_t num_threads=std::thread::hardware_concurrency())
 Stable parallel multi-way merge routine with sentinels. More...
 
template<typename RandomAccessIt , typename RandomBits >
void random_bipartition_shuffle (RandomAccessIt begin, RandomAccessIt end, size_t size_left_partition, RandomBits &urng)
 Similar to std::shuffle, but only generates a random bi-partition. More...
 
template<typename DataType , unsigned Radix = 8, typename KeyExtract = void>
auto make_radix_heap (KeyExtract &&key_extract) -> RadixHeap< DataType, KeyExtract, decltype(key_extract(std::declval< DataType >())), Radix >
 Helper to easily derive type of RadixHeap for a pre-C++17 compiler. More...
 
template<typename Tree , typename Compare >
bool splay_check (const Tree *t, const Tree *&out_tmin, const Tree *&out_tmax, const Compare &cmp)
 check the tree order, recursively calculate min and max elements More...
 
template<typename Tree , typename Compare >
bool splay_check (const Tree *t, const Compare &cmp)
 check the tree order More...
 
template<typename Key , typename Tree , typename Compare >
Tree * splay (const Key &k, Tree *t, const Compare &cmp)
 Splay using the key i (which may or may not be in the tree.) The starting root is t, and the tree used is defined by rat size fields are maintained. More...
 
template<typename Tree , typename Compare >
Tree * splay_insert (Tree *nn, Tree *t, const Compare &cmp)
 Insert key i into the tree t, if it is not already there. More...
 
template<typename Key , typename Tree , typename Compare >
Tree * splay_erase (const Key &k, Tree *&t, const Compare &cmp)
 Erases i from the tree if it's there. More...
 
template<typename Tree , typename Functor >
void splay_traverse_preorder (const Functor &f, const Tree *t)
 traverse the tree in preorder (left, node, right) More...
 
template<typename Tree , typename Functor >
void splay_traverse_postorder (const Functor &f, Tree *t)
 traverse the tree in postorder (left, right, node) More...
 
static bool operator== (const std::string &a, const StringView &b) noexcept
 Equality operator to compare a std::string with a StringView. More...
 
static bool operator!= (const std::string &a, const StringView &b) noexcept
 Inequality operator to compare a std::string with a StringView. More...
 
static bool operator< (const std::string &a, const StringView &b) noexcept
 Less operator to compare a std::string with a StringView lexicographically. More...
 
template<typename Type , typename... Args>
CountingPtr< Type > make_counting (Args &&...args)
 method analogous to std::make_shared and std::make_unique. More...
 
template<typename A , typename D >
void swap (CountingPtr< A, D > &a1, CountingPtr< A, D > &a2) noexcept
 swap enclosed object with another counting pointer (no reference counts need change) More...
 
template<typename A , typename D >
std::ostream & operator<< (std::ostream &os, const CountingPtr< A, D > &c)
 print pointer More...
 
template<class C , typename R , typename... A>
Delegate< R(A...)> make_delegate (C *const object_ptr, R(C::*const method_ptr)(A...)) noexcept
 constructor for wrapping a class::method with object pointer. More...
 
template<class C , typename R , typename... A>
Delegate< R(A...)> make_delegate (C &object_ptr, R(C::*const method_ptr)(A...)) noexcept
 constructor for wrapping a class::method with object reference. More...
 
template<class C , typename R , typename... A>
Delegate< R(A...)> make_delegate (C const &object_ptr, R(C::*const method_ptr)(A...) const) noexcept
 constructor for wrapping a const class::method with object reference. More...
 
void die_with_message (const std::string &msg)
 die with message - either throw an exception or die via std::terminate() More...
 
void die_with_message (const char *msg, const char *file, size_t line)
 die with message - either throw an exception or die via std::terminate() More...
 
void die_with_message (const std::string &msg, const char *file, size_t line)
 die with message - either throw an exception or die via std::terminate() More...
 
bool set_die_with_exception (bool b)
 Switch between dying via std::terminate() and throwing an exception. More...
 
template<typename TypeA , typename TypeB >
bool die_equal_compare (TypeA a, TypeB b)
 helper method to compare two values in die_unequal() More...
 
template<>
bool die_equal_compare (const char *a, const char *b)
 
template<>
bool die_equal_compare (float a, float b)
 
template<>
bool die_equal_compare (double a, double b)
 
template<typename Type >
Type die_unequal_eps_abs (const Type &t)
 simple replacement for std::abs More...
 
template<typename TypeA , typename TypeB >
bool die_equal_eps_compare (TypeA x, TypeB y, double eps)
 helper method to compare two values in die_unequal_eps() More...
 
std::string md5_hex (const void *data, uint32_t size)
 process data and return 16 byte (128 bit) digest hex encoded More...
 
std::string md5_hex (const std::string &str)
 process data and return 16 byte (128 bit) digest hex encoded More...
 
std::string md5_hex_uc (const void *data, uint32_t size)
 process data and return 16 byte (128 bit) digest upper-case hex encoded More...
 
std::string md5_hex_uc (const std::string &str)
 process data and return 16 byte (128 bit) digest upper-case hex encoded More...
 
std::string sha1_hex (const void *data, uint32_t size)
 process data and return 20 byte (160 bit) digest hex encoded More...
 
std::string sha1_hex (const std::string &str)
 process data and return 20 byte (160 bit) digest hex encoded More...
 
std::string sha1_hex_uc (const void *data, uint32_t size)
 process data and return 20 byte (160 bit) digest upper-case hex encoded More...
 
std::string sha1_hex_uc (const std::string &str)
 process data and return 20 byte (160 bit) digest upper-case hex encoded More...
 
std::string sha256_hex (const void *data, uint32_t size)
 process data and return 32 byte (256 bit) digest hex encoded More...
 
std::string sha256_hex (const std::string &str)
 process data and return 32 byte (256 bit) digest hex encoded More...
 
std::string sha256_hex_uc (const void *data, uint32_t size)
 process data and return 32 byte (256 bit) digest upper-case hex encoded More...
 
std::string sha256_hex_uc (const std::string &str)
 process data and return 32 byte (256 bit) digest upper-case hex encoded More...
 
std::string sha512_hex (const void *data, uint32_t size)
 process data and return 64 byte (512 bit) digest hex encoded More...
 
std::string sha512_hex (const std::string &str)
 process data and return 64 byte (512 bit) digest hex encoded More...
 
std::string sha512_hex_uc (const void *data, uint32_t size)
 process data and return 64 byte (512 bit) digest upper-case hex encoded More...
 
std::string sha512_hex_uc (const std::string &str)
 process data and return 64 byte (512 bit) digest upper-case hex encoded More...
 
LoggerOutputHookset_logger_output_hook (LoggerOutputHook *hook)
 set new LoggerOutputHook instance to receive global log lines. More...
 
LoggerOutputHookset_logger_to_stderr ()
 install default logger to cerr / stderr instead of stdout. More...
 
LoggerPrefixHookset_logger_prefix_hook (LoggerPrefixHook *hook)
 Set new LoggerPrefixHook instance to prefix global log lines. More...
 
template<typename T >
abs_diff (const T &a, const T &b)
 absolute difference, which also works for unsigned types More...
 
static uint16_t bswap16_generic (const uint16_t &x)
 bswap16 - generic implementation More...
 
static uint16_t bswap16 (const uint16_t &v)
 bswap16 - generic More...
 
static uint32_t bswap32_generic (const uint32_t &x)
 bswap32 - generic implementation More...
 
static uint32_t bswap32 (const uint32_t &v)
 bswap32 - generic More...
 
static uint64_t bswap64_generic (const uint64_t &x)
 bswap64 - generic implementation More...
 
static uint64_t bswap64 (const uint64_t &v)
 bswap64 - generic More...
 
template<typename Integral >
static unsigned clz_template (Integral x)
 clz (count leading zeros) - generic implementation More...
 
template<typename Integral >
unsigned clz (Integral x)
 
template<>
unsigned clz< int > (int i)
 clz (count leading zeros) More...
 
template<>
unsigned clz< unsigned > (unsigned i)
 clz (count leading zeros) More...
 
template<>
unsigned clz< long > (long i)
 clz (count leading zeros) More...
 
template<>
unsigned clz< unsigned long > (unsigned long i)
 clz (count leading zeros) More...
 
template<>
unsigned clz< long long > (long long i)
 clz (count leading zeros) More...
 
template<>
unsigned clz< unsigned long long > (unsigned long long i)
 clz (count leading zeros) More...
 
template<typename Integral >
static unsigned ctz_template (Integral x)
 ctz (count trailing zeros) - generic implementation More...
 
template<typename Integral >
unsigned ctz (Integral x)
 
template<>
unsigned ctz< int > (int i)
 ctz (count trailing zeros) More...
 
template<>
unsigned ctz< unsigned > (unsigned i)
 ctz (count trailing zeros) More...
 
template<>
unsigned ctz< long > (long i)
 ctz (count trailing zeros) More...
 
template<>
unsigned ctz< unsigned long > (unsigned long i)
 ctz (count trailing zeros) More...
 
template<>
unsigned ctz< long long > (long long i)
 ctz (count trailing zeros) More...
 
template<>
unsigned ctz< unsigned long long > (unsigned long long i)
 ctz (count trailing zeros) More...
 
template<typename IntegralN , typename IntegralK >
static constexpr auto div_ceil (const IntegralN &n, const IntegralK &k) -> decltype(n+k)
 calculate n div k with rounding up, for n and k positive! More...
 
template<typename Integral >
static unsigned ffs_template (Integral x)
 ffs (find first set bit) - generic implementation More...
 
static unsigned ffs (int i)
 find first set bit in integer, or zero if none are set. More...
 
static unsigned ffs (unsigned int i)
 find first set bit in integer, or zero if none are set. More...
 
static unsigned ffs (long i)
 find first set bit in integer, or zero if none are set. More...
 
static unsigned ffs (unsigned long i)
 find first set bit in integer, or zero if none are set. More...
 
static unsigned ffs (long long i)
 find first set bit in integer, or zero if none are set. More...
 
static unsigned ffs (unsigned long long i)
 find first set bit in integer, or zero if none are set. More...
 
template<typename IntegerType >
static unsigned integer_log2_floor_template (IntegerType i)
 calculate the log2 floor of an integer type More...
 
static unsigned integer_log2_floor (int i)
 calculate the log2 floor of an integer type More...
 
static unsigned integer_log2_floor (unsigned int i)
 calculate the log2 floor of an integer type More...
 
static unsigned integer_log2_floor (long i)
 calculate the log2 floor of an integer type More...
 
static unsigned integer_log2_floor (unsigned long i)
 calculate the log2 floor of an integer type More...
 
static unsigned integer_log2_floor (long long i)
 calculate the log2 floor of an integer type More...
 
static unsigned integer_log2_floor (unsigned long long i)
 calculate the log2 floor of an integer type More...
 
static unsigned integer_log2_ceil (int i)
 calculate the log2 floor of an integer type More...
 
static unsigned integer_log2_ceil (unsigned int i)
 calculate the log2 floor of an integer type More...
 
static unsigned integer_log2_ceil (long i)
 calculate the log2 floor of an integer type More...
 
static unsigned integer_log2_ceil (unsigned long i)
 calculate the log2 floor of an integer type More...
 
static unsigned integer_log2_ceil (long long i)
 calculate the log2 floor of an integer type More...
 
static unsigned integer_log2_ceil (unsigned long long i)
 calculate the log2 floor of an integer type More...
 
template<typename Integral >
static bool is_power_of_two_template (Integral i)
 
static bool is_power_of_two (int i)
 does what it says: true if i is a power of two More...
 
static bool is_power_of_two (unsigned int i)
 does what it says: true if i is a power of two More...
 
static bool is_power_of_two (long i)
 does what it says: true if i is a power of two More...
 
static bool is_power_of_two (unsigned long i)
 does what it says: true if i is a power of two More...
 
static bool is_power_of_two (long long i)
 does what it says: true if i is a power of two More...
 
static bool is_power_of_two (unsigned long long i)
 does what it says: true if i is a power of two More...
 
static unsigned popcount_generic8 (uint8_t x)
 popcount (count one bits) - generic SWAR implementation More...
 
static unsigned popcount_generic16 (uint16_t x)
 popcount (count one bits) - generic SWAR implementation More...
 
static unsigned popcount_generic32 (uint32_t x)
 popcount (count one bits) - generic SWAR implementation from https://stackoverflow.com/questions/109023 More...
 
static unsigned popcount_generic64 (uint64_t x)
 popcount (count one bits) - generic SWAR implementation More...
 
template<typename Integral >
unsigned popcount (Integral i)
 popcount (count one bits) More...
 
static size_t popcount (const void *data, size_t size)
 
template<unsigned D, typename T >
static constexpr T power_to_the (T x)
 power_to_the<D>(x) More...
 
static uint32_t rol32_generic (const uint32_t &x, int i)
 rol32 - generic implementation More...
 
static uint32_t rol32 (const uint32_t &x, int i)
 rol32 - generic More...
 
static uint64_t rol64_generic (const uint64_t &x, int i)
 rol64 - generic implementation More...
 
static uint64_t rol64 (const uint64_t &x, int i)
 rol64 - generic More...
 
static uint32_t ror32_generic (const uint32_t &x, int i)
 ror32 - generic implementation More...
 
static uint32_t ror32 (const uint32_t &x, int i)
 ror32 - generic More...
 
static uint64_t ror64_generic (const uint64_t &x, int i)
 ror64 - generic implementation More...
 
static uint64_t ror64 (const uint64_t &x, int i)
 ror64 - generic More...
 
template<typename Integral >
static Integral round_up_to_power_of_two_template (Integral n)
 
static int round_up_to_power_of_two (int i)
 does what it says: round up to next power of two More...
 
static unsigned int round_up_to_power_of_two (unsigned int i)
 does what it says: round up to next power of two More...
 
static long round_up_to_power_of_two (long i)
 does what it says: round up to next power of two More...
 
static unsigned long round_up_to_power_of_two (unsigned long i)
 does what it says: round up to next power of two More...
 
static long long round_up_to_power_of_two (long long i)
 does what it says: round up to next power of two More...
 
static unsigned long long round_up_to_power_of_two (unsigned long long i)
 does what it says: round up to next power of two More...
 
static int round_down_to_power_of_two (int i)
 does what it says: round down to next power of two More...
 
static unsigned int round_down_to_power_of_two (unsigned int i)
 does what it says: round down to next power of two More...
 
static long round_down_to_power_of_two (long i)
 does what it says: round down to next power of two More...
 
static unsigned long round_down_to_power_of_two (unsigned long i)
 does what it says: round down to next power of two More...
 
static long long round_down_to_power_of_two (long long i)
 does what it says: round down to next power of two More...
 
static unsigned long long round_down_to_power_of_two (unsigned long long i)
 does what it says: round down to next power of two More...
 
template<typename IntegralN , typename IntegralK >
static constexpr auto round_up (const IntegralN &n, const IntegralK &k) -> decltype(n+k)
 round n up to the next multiple of k, for n and k positive! More...
 
template<typename T >
int sgn (const T &val)
 sgn() - signum More...
 
template<typename Functor , typename Tuple >
auto apply_tuple (Functor &&f, Tuple &&t)
 Call the functor f with the contents of t as arguments. More...
 
template<size_t Size, typename Functor >
void call_for_range (Functor &&f)
 Call a generic functor (like a generic lambda) for the integers [0,Size). More...
 
template<size_t Begin, size_t End, typename Functor >
void call_for_range (Functor &&f)
 Call a generic functor (like a generic lambda) for the integers [Begin,End). More...
 
template<typename Functor , typename... Args>
void call_foreach (Functor &&f, Args &&...args)
 Call a generic functor (like a generic lambda) for each variadic template argument. More...
 
template<typename Functor , typename Tuple >
void call_foreach_tuple (Functor &&f, Tuple &&t)
 Call a generic functor (like a generic lambda) to each components of a tuple together with its zero-based index. More...
 
template<typename Functor , typename Tuple >
void call_foreach_tuple_with_index (Functor &&f, Tuple &&t)
 Call a generic functor (like a generic lambda) to each components of a tuple together with its zero-based index. More...
 
template<typename Functor , typename... Args>
void call_foreach_with_index (Functor &&f, Args &&...args)
 Call a generic functor (like a generic lambda) for each variadic template argument together with its zero-based index. More...
 
template<typename Reduce , typename Initial , typename... Args>
auto fold_left (Reduce &&r, Initial &&init, Args &&...args)
 Implements fold_left() – ((a * b) * c) – with a binary Reduce operation and initial value. More...
 
template<typename Reduce , typename Initial , typename Tuple >
auto fold_left_tuple (Reduce &&r, Initial &&init, Tuple &&t)
 Implements fold_left() – ((a * b) * c) – with a binary Reduce operation and initial value on a tuple. More...
 
template<typename Reduce , typename Initial , typename... Args>
auto fold_right (Reduce &&r, Initial &&init, Args &&...args)
 Implements fold_right() – (a * (b * c)) – with a binary Reduce operation and initial value. More...
 
template<typename Reduce , typename Initial , typename Tuple >
auto fold_right_tuple (Reduce &&r, Initial &&init, Tuple &&t)
 Implements fold_right() – (a * (b * c)) – with a binary Reduce operation and initial value on a tuple. More...
 
template<typename Functor >
static auto make_function_chain (const Functor &functor)
 Functor chain maker. Can also be called with a lambda function. More...
 
static auto make_function_chain ()
 Construct and empty function chain. More...
 
template<typename Input , typename Functor >
static auto make_function_stack (const Functor &functor)
 Function-style construction of a FunctionStack. More...
 
template<typename... Types>
void vexpand (Types &&...)
 
template<size_t Size, typename Functor >
auto vmap_for_range (Functor &&f)
 Vmap a generic functor (like a generic lambda) for the integers [0,Size). More...
 
template<size_t Begin, size_t End, typename Functor >
auto vmap_for_range (Functor &&f)
 Vmap a generic functor (like a generic lambda) for the integers [Begin,End). More...
 
template<typename Functor , typename... Args>
auto vmap_foreach (Functor &&f, Args &&...args)
 Call a generic functor (like a generic lambda) for each variadic template argument. More...
 
template<typename Functor , typename Tuple >
auto vmap_foreach_tuple (Functor &&f, Tuple &&t)
 Call a generic functor (like a generic lambda) for each variadic template argument and collect the result in a std::tuple<>. More...
 
template<typename Functor , typename Tuple >
auto vmap_foreach_tuple_with_index (Functor &&f, Tuple &&t)
 Call a generic functor (like a generic lambda) for each variadic template argument and collect the result in a std::tuple<>. More...
 
template<typename Functor , typename... Args>
auto vmap_foreach_with_index (Functor &&f, Args &&...args)
 Call a generic functor (like a generic lambda) for each variadic template argument together with its zero-based index. More...
 
int setenv (const char *name, const char *value, int overwrite)
 setenv - change or add an environment variable Windows porting madness because setenv() is apparently dangerous More...
 
static uint64_t siphash_plain (const uint8_t key[16], const uint8_t *m, size_t len)
 
static uint64_t siphash (const uint8_t key[16], const uint8_t *msg, size_t size)
 
static uint64_t siphash (const uint8_t *msg, size_t size)
 
static uint64_t siphash (const char *msg, size_t size)
 
static uint64_t siphash (const std::string &str)
 
template<typename Type >
static uint64_t siphash (const Type &value)
 
int compare_icase (const char *a, const char *b)
 returns +1/0/-1 like strcmp(a, b) but without regard for letter case More...
 
int compare_icase (const char *a, const std::string &b)
 returns +1/0/-1 like strcmp(a, b) but without regard for letter case More...
 
int compare_icase (const std::string &a, const char *b)
 returns +1/0/-1 like strcmp(a, b) but without regard for letter case More...
 
int compare_icase (const std::string &a, const std::string &b)
 returns +1/0/-1 like strcmp(a, b) but without regard for letter case More...
 
bool contains (const std::string &str, const std::string &pattern)
 Tests of string contains pattern. More...
 
bool contains (const std::string &str, const char *pattern)
 Tests of string contains pattern. More...
 
bool contains (const std::string &str, const char ch)
 Tests of string contains character. More...
 
static bool is_white (char c)
 
bool contains_word (const std::string &str, const char *word)
 Search the given string for a whitespace-delimited word. More...
 
bool contains_word (const std::string &str, const std::string &word)
 Search the given string for a whitespace-delimited word. More...
 
bool ends_with (const char *str, const char *match)
 Checks if the given match string is located at the end of this string. More...
 
bool ends_with (const char *str, const std::string &match)
 Checks if the given match string is located at the end of this string. More...
 
bool ends_with (const std::string &str, const char *match)
 Checks if the given match string is located at the end of this string. More...
 
bool ends_with (const std::string &str, const std::string &match)
 Checks if the given match string is located at the end of this string. More...
 
bool ends_with_icase (const char *str, const char *match)
 
bool ends_with_icase (const char *str, const std::string &match)
 
bool ends_with_icase (const std::string &str, const char *match)
 Checks if the given match string is located at the end of this string. More...
 
bool ends_with_icase (const std::string &str, const std::string &match)
 Checks if the given match string is located at the end of this string. More...
 
bool equal_icase (const char *a, const char *b)
 returns true if a == b without regard for letter case More...
 
bool equal_icase (const char *a, const std::string &b)
 returns true if a == b without regard for letter case More...
 
bool equal_icase (const std::string &a, const char *b)
 returns true if a == b without regard for letter case More...
 
bool equal_icase (const std::string &a, const std::string &b)
 returns true if a == b without regard for letter case More...
 
std::string & erase_all (std::string *str, char drop= ' ')
 Remove all occurrences of the given character in-place. More...
 
std::string & erase_all (std::string *str, const char *drop)
 Remove all occurrences of the given characters in-place. More...
 
std::string & erase_all (std::string *str, const std::string &drop)
 Remove all occurrences of the given characters in-place. More...
 
std::string erase_all (const std::string &str, char drop= ' ')
 Remove all occurrences of the given character, return copy of string. More...
 
std::string erase_all (const std::string &str, const char *drop)
 Remove all occurrences of the given characters, return copy of string. More...
 
std::string erase_all (const std::string &str, const std::string &drop)
 Remove all occurrences of the given characters, return copy of string. More...
 
std::string escape_html (const std::string &str)
 Escape characters for inclusion in HTML documents: replaces the characters <, >, & and " with HTML entities. More...
 
std::string escape_html (const char *str)
 Escape characters for inclusion in HTML documents: replaces the characters <, >, & and " with HTML entities. More...
 
std::string escape_uri (const std::string &str)
 Escape a string into a URI-encoding. More...
 
std::string escape_uri (const char *str)
 Escape a string into a URI-encoding. More...
 
std::string & expand_environment_variables (std::string *s)
 Expand substrings $ABC_123 and ${ABC_123} into the corresponding environment variables. More...
 
std::string expand_environment_variables (const std::string &s)
 Expand substrings $ABC_123 and ${ABC_123} into the corresponding environment variables. More...
 
std::string expand_environment_variables (const char *s)
 Expand substrings $ABC_123 and ${ABC_123} into the corresponding environment variables. More...
 
template<typename Separator1 , typename Separator2 >
static std::string extract_between_template (const std::string &str, const Separator1 &sep1, size_t sep1_size, const Separator2 &sep2)
 
std::string extract_between (const std::string &str, const char *sep1, const char *sep2)
 Search the string for given start and end separators and extract all characters between the both, if they are found. More...
 
std::string extract_between (const std::string &str, const char *sep1, const std::string &sep2)
 Search the string for given start and end separators and extract all characters between the both, if they are found. More...
 
std::string extract_between (const std::string &str, const std::string &sep1, const char *sep2)
 Search the string for given start and end separators and extract all characters between the both, if they are found. More...
 
std::string extract_between (const std::string &str, const std::string &sep1, const std::string &sep2)
 Search the string for given start and end separators and extract all characters between the both, if they are found. More...
 
std::string format_iec_units (uint64_t number, int precision=3)
 Format a byte size using IEC (Ki, Mi, Gi, Ti) suffixes (powers of two). More...
 
std::string format_si_units (uint64_t number, int precision)
 Format number as something like 1 TB. More...
 
static uint32_t hash_djb2 (const unsigned char *str)
 Simple, fast, but "insecure" string hash method by Dan Bernstein from http://www.cse.yorku.ca/~oz/hash.html. More...
 
static uint32_t hash_djb2 (const char *str)
 Simple, fast, but "insecure" string hash method by Dan Bernstein from http://www.cse.yorku.ca/~oz/hash.html. More...
 
static uint32_t hash_djb2 (const unsigned char *str, size_t size)
 Simple, fast, but "insecure" string hash method by Dan Bernstein from http://www.cse.yorku.ca/~oz/hash.html. More...
 
static uint32_t hash_djb2 (const char *str, size_t size)
 Simple, fast, but "insecure" string hash method by Dan Bernstein from http://www.cse.yorku.ca/~oz/hash.html. More...
 
static uint32_t hash_djb2 (const std::string &str)
 Simple, fast, but "insecure" string hash method by Dan Bernstein from http://www.cse.yorku.ca/~oz/hash.html. More...
 
static uint32_t hash_sdbm (const unsigned char *str)
 Simple, fast, but "insecure" string hash method by sdbm database from http://www.cse.yorku.ca/~oz/hash.html. More...
 
static uint32_t hash_sdbm (const char *str)
 Simple, fast, but "insecure" string hash method by sdbm database from http://www.cse.yorku.ca/~oz/hash.html. More...
 
static uint32_t hash_sdbm (const unsigned char *str, size_t size)
 Simple, fast, but "insecure" string hash method by sdbm database from http://www.cse.yorku.ca/~oz/hash.html. More...
 
static uint32_t hash_sdbm (const char *str, size_t size)
 Simple, fast, but "insecure" string hash method by sdbm database from http://www.cse.yorku.ca/~oz/hash.html. More...
 
static uint32_t hash_sdbm (const std::string &str)
 Simple, fast, but "insecure" string hash method by sdbm database from http://www.cse.yorku.ca/~oz/hash.html. More...
 
size_t index_of (const std::vector< std::string > &list, const char *str)
 Attempts to find str in the list and return the index. More...
 
size_t index_of (const std::vector< std::string > &list, const std::string &str)
 Attempts to find str in the list and return the index. More...
 
size_t index_of_icase (const std::vector< std::string > &list, const char *str)
 Attempts to find str in the list and return the index using case-insensitive comparisons. More...
 
size_t index_of_icase (const std::vector< std::string > &list, const std::string &str)
 Attempts to find str in the list and return the index using case-insensitive comparisons. More...
 
bool less_icase (const char *a, const char *b)
 returns true if a < b without regard for letter case More...
 
bool less_icase (const char *a, const std::string &b)
 returns true if a < b without regard for letter case More...
 
bool less_icase (const std::string &a, const char *b)
 returns true if a < b without regard for letter case More...
 
bool less_icase (const std::string &a, const std::string &b)
 returns true if a < b without regard for letter case More...
 
template<typename Param >
static size_t levenshtein_algorithm (const char *a, size_t a_size, const char *b, size_t b_size)
 Computes the Levenshtein string distance also called edit distance between two strings. More...
 
static size_t levenshtein (const char *a, const char *b)
 Computes the Levenshtein string distance between two strings. More...
 
static size_t levenshtein_icase (const char *a, const char *b)
 Computes the Levenshtein string distance between two strings. More...
 
static size_t levenshtein (const std::string &a, const std::string &b)
 Computes the Levenshtein string distance between two strings. More...
 
static size_t levenshtein_icase (const std::string &a, const std::string &b)
 Computes the Levenshtein string distance between two strings. More...
 
std::string pad (const std::string &s, size_t len, char pad_char= ' ')
 Truncate or pad string to exactly len characters. More...
 
bool parse_si_iec_units (const char *str, uint64_t *out_size, char default_unit=0)
 Parse a string like "343KB" or "44 GiB" into the corresponding size in bytes. More...
 
bool parse_si_iec_units (const std::string &str, uint64_t *out_size, char default_unit=0)
 Parse a string like "343KB" or "44 GiB" into the corresponding size in bytes. More...
 
static std::vector< std::string > & split (std::vector< std::string > *into, const char *sep, size_t sep_size, const std::string &str, std::string::size_type limit)
 
std::vector< std::string > split_words (const std::string &str, std::string::size_type limit=std::string::npos)
 Split the given string by whitespaces into distinct words. More...
 
std::string ssprintf (const char *fmt,...) TLX_ATTRIBUTE_FORMAT_PRINTF(1
 Helper for return the result of a sprintf() call inside a std::string. More...
 
std::string ssnprintf (size_t max_size, const char *fmt,...) TLX_ATTRIBUTE_FORMAT_PRINTF(2
 Helper for return the result of a snprintf() call inside a std::string. More...
 
template<typename String = std::string>
String ssprintf_generic (const char *fmt,...) TLX_ATTRIBUTE_FORMAT_PRINTF(1
 Helper for return the result of a sprintf() call inside a string object. More...
 
template<typename String >
String String ssprintf_generic (const char *fmt,...)
 
template<typename String = std::string>
String ssnprintf_generic (size_t max_size, const char *fmt,...) TLX_ATTRIBUTE_FORMAT_PRINTF(2
 Helper for return the result of a snprintf() call inside a string object. More...
 
template<typename String >
String String ssnprintf_generic (size_t max_size, const char *fmt,...)
 
bool starts_with (const char *str, const char *match)
 Checks if the given match string is located at the start of this string. More...
 
bool starts_with (const char *str, const std::string &match)
 Checks if the given match string is located at the start of this string. More...
 
bool starts_with (const std::string &str, const char *match)
 Checks if the given match string is located at the start of this string. More...
 
bool starts_with (const std::string &str, const std::string &match)
 Checks if the given match string is located at the start of this string. More...
 
bool starts_with_icase (const char *str, const char *match)
 Checks if the given match string is located at the start of this string. More...
 
bool starts_with_icase (const char *str, const std::string &match)
 Checks if the given match string is located at the start of this string. More...
 
bool starts_with_icase (const std::string &str, const char *match)
 Checks if the given match string is located at the start of this string. More...
 
bool starts_with_icase (const std::string &str, const std::string &match)
 Checks if the given match string is located at the start of this string. More...
 
char to_lower (char ch)
 Transform the given character to lower case without any localization. More...
 
std::string & to_lower (std::string *str)
 Transforms the given string to lowercase and returns a reference to it. More...
 
std::string to_lower (const std::string &str)
 Returns a copy of the given string converted to lowercase. More...
 
char to_upper (char ch)
 Transform the given character to upper case without any localization. More...
 
std::string & to_upper (std::string *str)
 Transforms the given string to uppercase and returns a reference to it. More...
 
std::string to_upper (const std::string &str)
 Returns a copy of the given string converted to uppercase. More...
 
std::string union_words (const std::string &wordsA, const std::string &wordsB)
 Return union of two keyword sets. More...
 
bool is_space (char ch)
 
std::string word_wrap (const std::string &str, unsigned int wrap=80)
 Try to wrap a string to 80 columns without split words. More...
 
double timestamp ()
 Returns number of seconds since the epoch, currently microsecond resolution. More...
 
template<typename... Types>
void unused (Types &&...)
 
template<typename Type >
void vector_free (std::vector< Type > &v)
 Simple method to free the underlying memory in a vector, because .clear() need not do it. More...
 
Stack Backtrace Printing
void print_raw_backtrace (FILE *out, unsigned int max_frames, const char *fmt,...) TLX_ATTRIBUTE_FORMAT_PRINTF(3
 Print a plain hex stack backtrace of the called function to FILE* out, prefixed with the given printf formatted output. More...
 
void print_raw_backtrace (FILE *out=stderr, unsigned int max_frames=63)
 Print a plain hex stack backtrace of the called function to FILE* out. More...
 
void print_cxx_backtrace (FILE *out=stderr, unsigned int max_frames=63)
 Print a demangled stack backtrace of the caller function to FILE* out. More...
 
void enable_segv_backtrace ()
 Install SIGSEGV signal handler and output backtrace on segmentation fault. More...
 
Parallel Sorting Algorithms
template<bool Stable, typename RandomAccessIterator , typename Comparator >
void parallel_mergesort_base (RandomAccessIterator begin, RandomAccessIterator end, Comparator comp, size_t num_threads=std::thread::hardware_concurrency(), MultiwayMergeSplittingAlgorithm mwmsa=MWMSA_DEFAULT)
 Parallel multiway mergesort main call. More...
 
template<typename RandomAccessIterator , typename Comparator = std::less< typename std::iterator_traits<RandomAccessIterator>::value_type>>
void parallel_mergesort (RandomAccessIterator begin, RandomAccessIterator end, Comparator comp=Comparator(), size_t num_threads=std::thread::hardware_concurrency(), MultiwayMergeSplittingAlgorithm mwmsa=MWMSA_DEFAULT)
 Parallel multiway mergesort. More...
 
template<typename RandomAccessIterator , typename Comparator = std::less< typename std::iterator_traits<RandomAccessIterator>::value_type>>
void stable_parallel_mergesort (RandomAccessIterator begin, RandomAccessIterator end, Comparator comp=Comparator(), size_t num_threads=std::thread::hardware_concurrency(), MultiwayMergeSplittingAlgorithm mwmsa=MWMSA_DEFAULT)
 Stable parallel multiway mergesort. More...
 
String Sorting Algorithms
static void sort_strings (unsigned char **strings, size_t size, size_t memory=0)
 Sort a set of strings represented by C-style uint8_t* in place. More...
 
static void sort_strings (char **strings, size_t size, size_t memory=0)
 Sort a set of strings represented by C-style char* in place. More...
 
static void sort_strings (const unsigned char **strings, size_t size, size_t memory=0)
 Sort a set of strings represented by C-style uint8_t* in place. More...
 
static void sort_strings (const char **strings, size_t size, size_t memory=0)
 Sort a set of strings represented by C-style char* in place. More...
 
static void sort_strings (std::vector< char * > &strings, size_t memory=0)
 Sort a set of strings represented by C-style char* in place. More...
 
static void sort_strings (std::vector< unsigned char * > &strings, size_t memory=0)
 Sort a set of strings represented by C-style uint8_t* in place. More...
 
static void sort_strings (std::vector< const char * > &strings, size_t memory=0)
 Sort a set of strings represented by C-style char* in place. More...
 
static void sort_strings (std::vector< const unsigned char * > &strings, size_t memory=0)
 Sort a set of strings represented by C-style uint8_t* in place. More...
 
static void sort_strings (std::string *strings, size_t size, size_t memory=0)
 Sort a set of std::strings in place. More...
 
static void sort_strings (std::vector< std::string > &strings, size_t memory=0)
 Sort a vector of std::strings in place. More...
 
static void sort_strings_lcp (unsigned char **strings, size_t size, uint32_t *lcp, size_t memory=0)
 Sort a set of strings represented by C-style uint8_t* in place. More...
 
static void sort_strings_lcp (char **strings, size_t size, uint32_t *lcp, size_t memory=0)
 Sort a set of strings represented by C-style char* in place. More...
 
static void sort_strings_lcp (const unsigned char **strings, size_t size, uint32_t *lcp, size_t memory=0)
 Sort a set of strings represented by C-style uint8_t* in place. More...
 
static void sort_strings_lcp (const char **strings, size_t size, uint32_t *lcp, size_t memory=0)
 Sort a set of strings represented by C-style char* in place. More...
 
static void sort_strings_lcp (std::vector< char * > &strings, uint32_t *lcp, size_t memory=0)
 Sort a set of strings represented by C-style char* in place. More...
 
static void sort_strings_lcp (std::vector< unsigned char * > &strings, uint32_t *lcp, size_t memory=0)
 Sort a set of strings represented by C-style uint8_t* in place. More...
 
static void sort_strings_lcp (std::vector< const char * > &strings, uint32_t *lcp, size_t memory=0)
 Sort a set of strings represented by C-style char* in place. More...
 
static void sort_strings_lcp (std::vector< const unsigned char * > &strings, uint32_t *lcp, size_t memory=0)
 Sort a set of strings represented by C-style uint8_t* in place. More...
 
static void sort_strings_lcp (std::string *strings, size_t size, uint32_t *lcp, size_t memory=0)
 Sort a set of std::strings in place. More...
 
static void sort_strings_lcp (std::vector< std::string > &strings, uint32_t *lcp, size_t memory=0)
 Sort a vector of std::strings in place. More...
 
static void sort_strings_parallel (unsigned char **strings, size_t size, size_t memory=0)
 Sort a set of strings in parallel represented by C-style uint8_t* in place. More...
 
static void sort_strings_parallel (char **strings, size_t size, size_t memory=0)
 Sort a set of strings in parallel represented by C-style char* in place. More...
 
static void sort_strings_parallel (const unsigned char **strings, size_t size, size_t memory=0)
 Sort a set of strings in parallel represented by C-style uint8_t* in place. More...
 
static void sort_strings_parallel (const char **strings, size_t size, size_t memory=0)
 Sort a set of strings in parallel represented by C-style char* in place. More...
 
static void sort_strings_parallel (std::vector< char * > &strings, size_t memory=0)
 Sort a set of strings in parallel represented by C-style char* in place. More...
 
static void sort_strings_parallel (std::vector< unsigned char * > &strings, size_t memory=0)
 Sort a set of strings in parallel represented by C-style uint8_t* in place. More...
 
static void sort_strings_parallel (std::vector< const char * > &strings, size_t memory=0)
 Sort a set of strings in parallel represented by C-style char* in place. More...
 
static void sort_strings_parallel (std::vector< const unsigned char * > &strings, size_t memory=0)
 Sort a set of strings in parallel represented by C-style uint8_t* in place. More...
 
static void sort_strings_parallel (std::string *strings, size_t size, size_t memory=0)
 Sort a set of std::strings in place in parallel. More...
 
static void sort_strings_parallel (std::vector< std::string > &strings, size_t memory=0)
 Sort a vector of std::strings in place in parallel. More...
 
static void sort_strings_parallel_lcp (unsigned char **strings, size_t size, uint32_t *lcp, size_t memory=0)
 Sort a set of strings in parallel represented by C-style uint8_t* in place. More...
 
static void sort_strings_parallel_lcp (char **strings, size_t size, uint32_t *lcp, size_t memory=0)
 Sort a set of strings in parallel represented by C-style char* in place. More...
 
static void sort_strings_parallel_lcp (const unsigned char **strings, size_t size, uint32_t *lcp, size_t memory=0)
 Sort a set of strings in parallel represented by C-style uint8_t* in place. More...
 
static void sort_strings_parallel_lcp (const char **strings, size_t size, uint32_t *lcp, size_t memory=0)
 Sort a set of strings in parallel represented by C-style char* in place. More...
 
static void sort_strings_parallel_lcp (std::vector< char * > &strings, uint32_t *lcp, size_t memory=0)
 Sort a set of strings in parallel represented by C-style char* in place. More...
 
static void sort_strings_parallel_lcp (std::vector< unsigned char * > &strings, uint32_t *lcp, size_t memory=0)
 Sort a set of strings in parallel represented by C-style uint8_t* in place. More...
 
static void sort_strings_parallel_lcp (std::vector< const char * > &strings, uint32_t *lcp, size_t memory=0)
 Sort a set of strings in parallel represented by C-style char* in place. More...
 
static void sort_strings_parallel_lcp (std::vector< const unsigned char * > &strings, uint32_t *lcp, size_t memory=0)
 Sort a set of strings in parallel represented by C-style uint8_t* in place. More...
 
static void sort_strings_parallel_lcp (std::string *strings, size_t size, uint32_t *lcp, size_t memory=0)
 Sort a set of std::strings in place in parallel. More...
 
static void sort_strings_parallel_lcp (std::vector< std::string > &strings, uint32_t *lcp, size_t memory=0)
 Sort a vector of std::strings in place in parallel. More...
 
Base64 Encoding and Decoding
std::string base64_encode (const void *data, size_t size, size_t line_break=0)
 Encode the given binary data into base64 representation as described in RFC 2045 or RFC 3548. More...
 
std::string base64_encode (const std::string &str, size_t line_break=0)
 Encode the given binary string into base64 representation as described in RFC 2045 or RFC 3548. More...
 
std::string base64_decode (const void *data, size_t size, bool strict=true)
 Decode a string in base64 representation as described in RFC 2045 or RFC 3548 and return the original data. More...
 
std::string base64_decode (const std::string &str, bool strict=true)
 Decode a string in base64 representation as described in RFC 2045 or RFC 3548 and return the original data. More...
 
Bitdump Methods
std::string bitdump_le8 (const void *const data, size_t size)
 Dump a (binary) string as a sequence of 8-bit little-endian bytes. More...
 
std::string bitdump_le8 (const std::string &str)
 Dump a (binary) string as a sequence of 8-bit little-endian bytes. More...
 
std::string bitdump_be8 (const void *const data, size_t size)
 Dump a (binary) string as a sequence of 8-bit big-endian bytes. More...
 
std::string bitdump_be8 (const std::string &str)
 Dump a (binary) string as a sequence of 8-bit big-endian bytes. More...
 
template<typename Type >
std::string bitdump_le8_type (const Type &t)
 Dump a (binary) item as a sequence of 8-bit little-endian bytes. More...
 
template<typename Type >
std::string bitdump_be8_type (const Type &t)
 Dump a (binary) item as a sequence of 8-bit big-endian bytes. More...
 
Hexdump Methods
std::string hexdump (const void *const data, size_t size)
 Dump a (binary) string as a sequence of uppercase hexadecimal pairs. More...
 
std::string hexdump (const std::string &str)
 Dump a (binary) string as a sequence of uppercase hexadecimal pairs. More...
 
std::string hexdump (const std::vector< char > &data)
 Dump a char vector as a sequence of uppercase hexadecimal pairs. More...
 
std::string hexdump (const std::vector< uint8_t > &data)
 Dump a uint8_t vector as a sequence of uppercase hexadecimal pairs. More...
 
std::string hexdump_sourcecode (const std::string &str, const std::string &var_name="name")
 Dump a (binary) string into a C source code snippet. More...
 
std::string hexdump_lc (const void *const data, size_t size)
 Dump a (binary) string as a sequence of lowercase hexadecimal pairs. More...
 
std::string hexdump_lc (const std::string &str)
 Dump a (binary) string as a sequence of lowercase hexadecimal pairs. More...
 
std::string hexdump_lc (const std::vector< char > &data)
 Dump a char vector as a sequence of lowercase hexadecimal pairs. More...
 
std::string hexdump_lc (const std::vector< uint8_t > &data)
 Dump a uint8_t vector as a sequence of lowercase hexadecimal pairs. More...
 
std::string parse_hexdump (const std::string &str)
 Read a string as a sequence of hexadecimal pairs. More...
 
template<typename Type >
std::string hexdump_type (const Type &t)
 Dump a (binary) item as a sequence of uppercase hexadecimal pairs. More...
 
template<typename Type >
std::string hexdump_lc_type (const Type &t)
 Dump a (binary) item as a sequence of lowercase hexadecimal pairs. More...
 
Split and Join
std::string join (char glue, const std::vector< std::string > &parts)
 Join a vector of strings by some glue character between each pair from the sequence. More...
 
std::string join (const char *glue, const std::vector< std::string > &parts)
 Join a vector of strings by some glue string between each pair from the sequence. More...
 
std::string join (const std::string &glue, const std::vector< std::string > &parts)
 Join a vector of strings by some glue string between each pair from the sequence. More...
 
template<typename Glue , typename Iterator >
static std::string join (Glue glue, Iterator first, Iterator last)
 Join a sequence of strings by some glue string between each pair from the sequence. More...
 
template<typename Container >
static std::string join (char glue, const Container &parts)
 Join a Container of strings by some glue character between each pair from the sequence. More...
 
template<typename Container >
static std::string join (const char *glue, const Container &parts)
 Join a Container of strings by some glue string between each pair from the sequence. More...
 
template<typename Container >
static std::string join (const std::string &glue, const Container &parts)
 Join a Container of strings by some glue string between each pair from the sequence. More...
 
std::string join_quoted (const std::vector< std::string > &str, char sep, char quote, char escape)
 Join a vector of strings using a separator character. More...
 
std::string join_quoted (const std::vector< std::string > &str)
 Join a vector of strings using spaces as separator character. More...
 
std::vector< std::string > split (char sep, const std::string &str, std::string::size_type limit=std::string::npos)
 Split the given string at each separator character into distinct substrings. More...
 
std::vector< std::string > split (const char *sep, const std::string &str, std::string::size_type limit=std::string::npos)
 Split the given string at each separator string into distinct substrings. More...
 
std::vector< std::string > split (const std::string &sep, const std::string &str, std::string::size_type limit=std::string::npos)
 Split the given string at each separator string into distinct substrings. More...
 
std::vector< std::string > split (char sep, const std::string &str, std::string::size_type min_fields, std::string::size_type limit)
 Split the given string at each separator character into distinct substrings. More...
 
std::vector< std::string > split (const char *sep, const std::string &str, std::string::size_type min_fields, std::string::size_type limit)
 Split the given string at each separator string into distinct substrings. More...
 
std::vector< std::string > split (const std::string &sep, const std::string &str, std::string::size_type min_fields, std::string::size_type limit)
 Split the given string at each separator string into distinct substrings. More...
 
std::vector< std::string > & split (std::vector< std::string > *into, char sep, const std::string &str, std::string::size_type limit=std::string::npos)
 Split the given string at each separator character into distinct substrings. More...
 
std::vector< std::string > & split (std::vector< std::string > *into, const char *sep, const std::string &str, std::string::size_type limit=std::string::npos)
 Split the given string at each separator string into distinct substrings. More...
 
std::vector< std::string > & split (std::vector< std::string > *into, const std::string &sep, const std::string &str, std::string::size_type limit=std::string::npos)
 Split the given string at each separator string into distinct substrings. More...
 
std::vector< std::string > & split (std::vector< std::string > *into, char sep, const std::string &str, std::string::size_type min_fields, std::string::size_type limit)
 Split the given string at each separator character into distinct substrings. More...
 
std::vector< std::string > & split (std::vector< std::string > *into, const char *sep, const std::string &str, std::string::size_type min_fields, std::string::size_type limit)
 Split the given string at each separator string into distinct substrings. More...
 
std::vector< std::string > & split (std::vector< std::string > *into, const std::string &sep, const std::string &str, std::string::size_type min_fields, std::string::size_type limit)
 Split the given string at each separator string into distinct substrings. More...
 
std::vector< std::string > split_quoted (const std::string &str, char sep, char quote, char escape)
 Split the given string at each separator character into distinct substrings. More...
 
std::vector< std::string > split_quoted (const std::string &str)
 Split the given string at each space into distinct substrings. More...
 
template<typename Functor >
static void split_view (char sep, const std::string &str, Functor &&callback, std::string::size_type limit=std::string::npos)
 Split the given string at each separator character into distinct substrings, and call the given callback with a StringView for each substring. More...
 
Search and Replace
std::string & replace_first (std::string *str, const std::string &needle, const std::string &instead)
 Replace only the first occurrence of needle in str. More...
 
std::string & replace_first (std::string *str, const std::string &needle, const char *instead)
 Replace only the first occurrence of needle in str. More...
 
std::string & replace_first (std::string *str, const char *needle, const std::string &instead)
 Replace only the first occurrence of needle in str. More...
 
std::string & replace_first (std::string *str, const char *needle, const char *instead)
 Replace only the first occurrence of needle in str. More...
 
std::string & replace_first (std::string *str, char needle, char instead)
 Replace only the first occurrence of needle in str. More...
 
std::string replace_first (const std::string &str, const std::string &needle, const std::string &instead)
 Replace only the first occurrence of needle in str. More...
 
std::string replace_first (const std::string &str, const std::string &needle, const char *instead)
 Replace only the first occurrence of needle in str. More...
 
std::string replace_first (const std::string &str, const char *needle, const std::string &instead)
 Replace only the first occurrence of needle in str. More...
 
std::string replace_first (const std::string &str, const char *needle, const char *instead)
 Replace only the first occurrence of needle in str. More...
 
std::string replace_first (const std::string &str, char needle, char instead)
 Replace only the first occurrence of needle in str. More...
 
std::string & replace_all (std::string *str, const std::string &needle, const std::string &instead)
 Replace all occurrences of needle in str. More...
 
std::string & replace_all (std::string *str, const std::string &needle, const char *instead)
 Replace all occurrences of needle in str. More...
 
std::string & replace_all (std::string *str, const char *needle, const std::string &instead)
 Replace all occurrences of needle in str. More...
 
std::string & replace_all (std::string *str, const char *needle, const char *instead)
 Replace all occurrences of needle in str. More...
 
std::string & replace_all (std::string *str, char needle, char instead)
 Replace all occurrences of needle in str. More...
 
std::string replace_all (const std::string &str, const std::string &needle, const std::string &instead)
 Replace all occurrences of needle in str. More...
 
std::string replace_all (const std::string &str, const std::string &needle, const char *instead)
 Replace all occurrences of needle in str. More...
 
std::string replace_all (const std::string &str, const char *needle, const std::string &instead)
 Replace all occurrences of needle in str. More...
 
std::string replace_all (const std::string &str, const char *needle, const char *instead)
 Replace all occurrences of needle in str. More...
 
std::string replace_all (const std::string &str, char needle, char instead)
 Replace all occurrences of needle in str. More...
 
Trim
std::string & trim (std::string *str)
 Trims the given string in-place on the left and right. More...
 
std::string & trim (std::string *str, const char *drop)
 Trims the given string in-place on the left and right. More...
 
std::string & trim (std::string *str, const std::string &drop)
 Trims the given string in-place on the left and right. More...
 
std::string trim (const std::string &str)
 Trims the given string in-place on the left and right. More...
 
std::string trim (const std::string &str, const char *drop)
 Trims the given string in-place on the left and right. More...
 
std::string trim (const std::string &str, const std::string &drop)
 Trims the given string in-place on the left and right. More...
 
std::string & trim_right (std::string *str)
 Trims the given string in-place only on the right. More...
 
std::string & trim_right (std::string *str, const char *drop)
 Trims the given string in-place only on the right. More...
 
std::string & trim_right (std::string *str, const std::string &drop)
 Trims the given string in-place only on the right. More...
 
std::string trim_right (const std::string &str)
 Trims the given string only on the right. More...
 
std::string trim_right (const std::string &str, const char *drop)
 Trims the given string only on the right. More...
 
std::string trim_right (const std::string &str, const std::string &drop)
 Trims the given string only on the right. More...
 
std::string & trim_left (std::string *str)
 Trims the given string in-place only on the left. More...
 
std::string & trim_left (std::string *str, const char *drop)
 Trims the given string in-place only on the left. More...
 
std::string & trim_left (std::string *str, const std::string &drop)
 Trims the given string in-place only on the left. More...
 
std::string trim_left (const std::string &str)
 Trims the given string only on the left. More...
 
std::string trim_left (const std::string &str, const char *drop)
 Trims the given string only on the left. More...
 
std::string trim_left (const std::string &str, const std::string &drop)
 Trims the given string only on the left. More...
 

Variables

bool parallel_multiway_merge_force_sequential
 setting to force all parallel_multiway_merge() calls to run sequentially More...
 
bool parallel_multiway_merge_force_parallel
 setting to force parallel_multiway_merge() calls to run with parallel code More...
 
size_t parallel_multiway_merge_minimal_k
 minimal number of sequences for switching to parallel merging More...
 
size_t parallel_multiway_merge_minimal_n
 minimal number of items for switching to parallel merging More...
 
size_t parallel_multiway_merge_oversampling
 default oversampling factor for parallel_multiway_merge More...
 
static std::atomic< bool > s_die_with_exception
 
static DefaultLoggerOutputCOut s_default_logger_cout
 default logger singletons More...
 
static DefaultLoggerOutputCErr s_default_logger_cerr
 default logger singletons More...
 
static std::atomic< LoggerOutputHook * > s_logger_output_hook
 global logger output hook More...
 
static std::atomic< LoggerPrefixHook * > s_logger_prefix_hook
 global logger prefix hook More...
 
static std::mutex s_timer_add_mutex
 

Typedef Documentation

using counting_ptr = CountingPtr<Type>

make alias due to similarity with std::shared_ptr<T>

Definition at line 305 of file counting_ptr.hpp.

make alias for dummy deleter

Definition at line 309 of file counting_ptr.hpp.

using delegate = Delegate<T, Allocator>

make template alias due to similarity with std::function

Definition at line 426 of file delegate.hpp.

make alias due to CountingPtr's similarity with std::shared_ptr<T>

Definition at line 389 of file counting_ptr.hpp.

alias for STL-like code style

Definition at line 93 of file semaphore.hpp.

typedef uint32_t u32

Definition at line 32 of file sha256.cpp.

typedef uint64_t u64

Definition at line 33 of file sha256.cpp.

Function Documentation

bool tlx::die_equal_compare ( TypeA  a,
TypeB  b 
)
inline

helper method to compare two values in die_unequal()

Definition at line 108 of file core.hpp.

bool tlx::die_equal_compare ( const char *  a,
const char *  b 
)
inline

Definition at line 113 of file core.hpp.

bool tlx::die_equal_compare ( float  a,
float  b 
)
inline

Definition at line 119 of file core.hpp.

bool tlx::die_equal_compare ( double  a,
double  b 
)
inline

Definition at line 125 of file core.hpp.

bool tlx::die_equal_eps_compare ( TypeA  x,
TypeB  y,
double  eps 
)
inline

helper method to compare two values in die_unequal_eps()

Definition at line 173 of file core.hpp.

Type tlx::die_unequal_eps_abs ( const Type &  t)
inline

simple replacement for std::abs

Definition at line 167 of file core.hpp.

void die_with_message ( const std::string &  msg)

die with message - either throw an exception or die via std::terminate()

Definition at line 29 of file core.cpp.

void die_with_message ( const char *  msg,
const char *  file,
size_t  line 
)

die with message - either throw an exception or die via std::terminate()

Definition at line 39 of file core.cpp.

void die_with_message ( const std::string &  msg,
const char *  file,
size_t  line 
)

die with message - either throw an exception or die via std::terminate()

Definition at line 45 of file core.cpp.

void enable_segv_backtrace ( )

Install SIGSEGV signal handler and output backtrace on segmentation fault.

Compile with -rdynamic for more useful output.

Definition at line 178 of file backtrace.cpp.

bool tlx::ends_with_icase ( const char *  str,
const char *  match 
)

Definition at line 75 of file ends_with.cpp.

bool tlx::ends_with_icase ( const char *  str,
const std::string &  match 
)

Definition at line 91 of file ends_with.cpp.

static std::string tlx::extract_between_template ( const std::string &  str,
const Separator1 &  sep1,
size_t  sep1_size,
const Separator2 &  sep2 
)
inlinestatic

Definition at line 19 of file extract_between.cpp.

bool tlx::is_space ( char  ch)

Definition at line 17 of file word_wrap.cpp.

static bool tlx::is_white ( char  c)
inlinestatic

Definition at line 15 of file contains_word.cpp.

CountingPtr<Type> tlx::make_counting ( Args &&...  args)

method analogous to std::make_shared and std::make_unique.

Definition at line 313 of file counting_ptr.hpp.

Delegate< R(A...)> make_delegate ( C *const  object_ptr,
R(C::*)(A...)  method_ptr 
)
inlinenoexcept

constructor for wrapping a class::method with object pointer.

constructor for wrapping a const class::method with object pointer.

Definition at line 431 of file delegate.hpp.

Delegate<R(A...)> tlx::make_delegate ( C &  object_ptr,
R(C::*)(A...)  method_ptr 
)
inlinenoexcept

constructor for wrapping a class::method with object reference.

Definition at line 447 of file delegate.hpp.

Delegate<R(A...)> tlx::make_delegate ( C const &  object_ptr,
R(C::*)(A...) const  method_ptr 
)
inlinenoexcept

constructor for wrapping a const class::method with object reference.

Definition at line 455 of file delegate.hpp.

std::ostream& tlx::operator<< ( std::ostream &  os,
const CountingPtr< A, D > &  c 
)

print pointer

Definition at line 326 of file counting_ptr.hpp.

void void print_cxx_backtrace ( FILE *  out = stderr,
unsigned int  max_frames = 63 
)

Print a demangled stack backtrace of the caller function to FILE* out.

Warning
The binary has to be compiled with -rdynamic for meaningful output.

Definition at line 73 of file backtrace.cpp.

void print_raw_backtrace ( FILE *  out,
unsigned int  max_frames,
const char *  fmt,
  ... 
)

Print a plain hex stack backtrace of the called function to FILE* out, prefixed with the given printf formatted output.

Definition at line 30 of file backtrace.cpp.

void print_raw_backtrace ( FILE *  out,
unsigned int  max_frames 
)

Print a plain hex stack backtrace of the called function to FILE* out.

Definition at line 69 of file backtrace.cpp.

bool set_die_with_exception ( bool  b)

Switch between dying via std::terminate() and throwing an exception.

Alternatively define the macro TLX_DIE_WITH_EXCEPTION=1

Definition at line 52 of file core.cpp.

LoggerOutputHook * set_logger_output_hook ( LoggerOutputHook hook)

set new LoggerOutputHook instance to receive global log lines.

returns the old hook.

Definition at line 65 of file core.cpp.

LoggerPrefixHook * set_logger_prefix_hook ( LoggerPrefixHook hook)

Set new LoggerPrefixHook instance to prefix global log lines.

Returns the old hook.

Definition at line 80 of file core.cpp.

LoggerOutputHook * set_logger_to_stderr ( )

install default logger to cerr / stderr instead of stdout.

returns the old hook.

Definition at line 69 of file core.cpp.

static uint64_t tlx::siphash ( const uint8_t  key[16],
const uint8_t *  msg,
size_t  size 
)
inlinestatic

Definition at line 240 of file siphash.hpp.

static uint64_t tlx::siphash ( const uint8_t *  msg,
size_t  size 
)
inlinestatic

Definition at line 249 of file siphash.hpp.

static uint64_t tlx::siphash ( const char *  msg,
size_t  size 
)
inlinestatic

Definition at line 257 of file siphash.hpp.

static uint64_t tlx::siphash ( const std::string &  str)
inlinestatic

Definition at line 262 of file siphash.hpp.

static uint64_t tlx::siphash ( const Type &  value)
inlinestatic

Definition at line 268 of file siphash.hpp.

static uint64_t tlx::siphash_plain ( const uint8_t  key[16],
const uint8_t *  m,
size_t  len 
)
inlinestatic

Definition at line 42 of file siphash.hpp.

static std::vector<std::string>& tlx::split ( std::vector< std::string > *  into,
const char *  sep,
size_t  sep_size,
const std::string &  str,
std::string::size_type  limit 
)
inlinestatic

Definition at line 107 of file split.cpp.

String String tlx::ssnprintf_generic ( size_t  max_size,
const char *  fmt,
  ... 
)

Definition at line 70 of file ssprintf_generic.hpp.

String String tlx::ssprintf_generic ( const char *  fmt,
  ... 
)

Definition at line 35 of file ssprintf_generic.hpp.

void tlx::swap ( CountingPtr< A, D > &  a1,
CountingPtr< A, D > &  a2 
)
noexcept

swap enclosed object with another counting pointer (no reference counts need change)

Definition at line 320 of file counting_ptr.hpp.

double timestamp ( )

Returns number of seconds since the epoch, currently microsecond resolution.

Definition at line 17 of file timestamp.cpp.

void tlx::unused ( Types &&  ...)

Definition at line 20 of file unused.hpp.

void tlx::vector_free ( std::vector< Type > &  v)

Simple method to free the underlying memory in a vector, because .clear() need not do it.

Definition at line 21 of file vector_free.hpp.

Variable Documentation

DefaultLoggerOutputCErr s_default_logger_cerr
static

default logger singletons

Definition at line 58 of file core.cpp.

DefaultLoggerOutputCOut s_default_logger_cout
static

default logger singletons

Definition at line 55 of file core.cpp.

std::atomic<bool> s_die_with_exception
static

Definition at line 21 of file core.cpp.

std::atomic<LoggerOutputHook*> s_logger_output_hook
static

global logger output hook

Definition at line 61 of file core.cpp.

std::atomic<LoggerPrefixHook*> s_logger_prefix_hook
static

global logger prefix hook

Definition at line 76 of file core.cpp.

std::mutex s_timer_add_mutex
static

Definition at line 22 of file multi_timer.cpp.