General Utility Library for C++14  2.11
Classes | Typedefs | Enumerations | Functions | Variables
gul14 Namespace Reference

Detailed Description

Namespace gul14 contains all functions and classes of the General Utility Library.

Classes

class  ConvertingStringView
 A string view that can automatically convert numbers into strings. More...
 
class  bad_expected_access
 The exception thrown by gul14::expected if value() is called, but no value is present. More...
 
class  expected
 An expected<T, E> is an object that normally contains an "expected" object of type T, but it can alternatively contain another, "unexpected" or "error" object of type E. More...
 
class  unexpected
 Class template for constructing the unexpected value of an expected object. More...
 
class  FinalAction
 FinalAction allows us to execute something if the FinalAction object leaves the scope. More...
 
class  HexdumpParameterForward
 Helper object used to enable a convenient syntax to dump things to a stream. More...
 
class  optional
 A class template that can either contain a value of a certain type or not. More...
 
class  optional< T & >
 A class template that can either contain a value of a certain type or not. More...
 
class  SlidingBuffer
 A circular data buffer of (semi-)fixed capacity to which elements can be added at the front or at the back. More...
 
class  SlidingBufferExposed
 A variant of SlidingBuffer that exposes the underlying container through its iterator interface. More...
 
class  SmallVector
 A resizable container with contiguous storage that can hold a specified number of elements without allocating memory on the heap. More...
 
class  span
 A view to a contiguous sequence of objects. More...
 
struct  MinMax
 Object that is designed to holds two values: minimum and maximum of something. More...
 
class  StandardDeviationMean
 A struct holding a standard deviation and a mean value. More...
 
class  basic_string_view
 A view to a contiguous sequence of chars or char-like objects. More...
 
class  ThreadPool
 A pool of worker threads with a task queue. More...
 
struct  IsContainerLike
 Helper type trait object to determine if a type is a container. More...
 
class  Trigger
 A class that allows sending triggers and waiting for them across different threads. More...
 
class  FailToInstantiate
 A helper class to debug types. More...
 
struct  in_place_t
 A type for constructor disambiguation, used by gul14::expected, gul14::optional, and gul14::variant. More...
 
struct  in_place_type_t
 A type for constructor disambiguation. More...
 
struct  in_place_index_t
 A type for constructor disambiguation. More...
 
struct  monostate
 A well-behaved empty type for use with gul14::variant and gul14::expected. More...
 
class  bad_variant_access
 The exception thrown if the wrong type is accessed on a gul14::variant. More...
 
class  variant
 A "type-safe union". More...
 
struct  OverloadSet
 A function object that works like an overload set of functions. More...
 
struct  OverloadSet< Fct1 >
 OverloadSet for a single function object. More...
 

Typedefs

template<typename T >
using BitFunctionReturnType = std::enable_if_t< std::is_integral< T >::value and not std::is_same< std::decay_t< T >, bool >::value, std::decay_t< T > >
 Return type of the bit manipulation functions. More...
 
using statistics_result_type = double
 Type used to return statistic properties.
 
using string_view = basic_string_view< char >
 A view to a contiguous sequence of chars. More...
 
using u16string_view = basic_string_view< char16_t >
 A view to a contiguous sequence of char16_ts. More...
 
using u32string_view = basic_string_view< char32_t >
 A view to a contiguous sequence of char32_ts. More...
 
using wstring_view = basic_string_view< wchar_t >
 A view to a contiguous sequence of wchar_ts. More...
 
template<typename T >
using remove_cvref = typename std::remove_cv< std::remove_reference_t< T > >
 A template metafunction that removes const, volatile, and reference qualifiers from a type. More...
 
template<typename T >
using remove_cvref_t = typename remove_cvref< T >::type
 A template metafunction that removes const, volatile, and reference qualifiers from a type. More...
 
template<typename... >
using void_t = void
 A type mapping an arbitrary list of types to void (for SFINAE). More...
 
template<typename F , typename... Args>
using invoke_result = detail_invoke_result::invoke_result< void, F, Args... >
 A metafunction that computes the result of invoking a callable object of type F with the given arguments. More...
 
template<typename F , typename... Args>
using invoke_result_t = typename invoke_result< F, Args... >::type
 A shortcut for invoke_result<...>::type. More...
 
template<typename F , typename... Args>
using is_invocable = detail_invocable::is_invocable< void, F, Args... >
 A type trait that checks whether a callable object of type F can be invoked with the given arguments. More...
 
template<typename R , typename F , typename... Args>
using is_invocable_r = detail_invocable::is_invocable_r< void, R, F, Args... >
 A type trait that checks whether a callable object of type F can be invoked with the given arguments and returns a result convertible to R. More...
 

Enumerations

enum class  endian { little , big , native }
 An enum to determine the endianness of multi-byte scalars on the current platform. More...
 
enum class  ShrinkBehavior { keep_front_elements , keep_back_elements }
 Determine how a SlidingBuffer handles decreases of its size. More...
 
enum class  TaskState { pending , running , complete , canceled }
 An enum describing the state of an individual task. More...
 

Functions

template<typename T = unsigned, typename ReturnT = BitFunctionReturnType<T>>
constexpr auto bit_set (unsigned bit) noexcept -> ReturnT
 Set a bit in an integral type. More...
 
template<typename T , typename ReturnT = BitFunctionReturnType<T>>
constexpr auto bit_set (T previous, unsigned bit) noexcept -> ReturnT
 Set a bit in an integral value. More...
 
template<typename T , typename ReturnT = BitFunctionReturnType<T>>
constexpr auto bit_reset (T previous, unsigned bit) noexcept -> ReturnT
 Reset a bit in an integral value. More...
 
template<typename T , typename ReturnT = BitFunctionReturnType<T>>
constexpr auto bit_flip (T previous, unsigned bit) noexcept -> ReturnT
 Flip a bit in an integral value. More...
 
template<typename T >
constexpr bool bit_test (T bits, unsigned bit) noexcept
 Test a bit in an integral value. More...
 
constexpr bool is_big_endian ()
 Determine whether this platform uses big-endian (Motorola) order for storing multi-byte quantities in memory. More...
 
constexpr bool is_little_endian ()
 Determine whether this platform uses little-endian (Intel) order for storing multi-byte quantities in memory. More...
 
constexpr char lowercase_ascii (char c) noexcept
 Return the ASCII lowercase equivalent of the given character (or the unchanged character, if it is not an ASCII letter). More...
 
GUL_EXPORT std::string lowercase_ascii (gul14::string_view str)
 Return a copy of the given string in which all ASCII characters are replaced by their lowercase equivalents. More...
 
GUL_EXPORT std::string & lowercase_ascii_inplace (std::string &str) noexcept
 Replace all ASCII characters in a string by their lowercase equivalents. More...
 
constexpr char uppercase_ascii (char c) noexcept
 Return the ASCII uppercase equivalent of the given character (or the unchanged character, if it is not an ASCII letter). More...
 
GUL_EXPORT std::string uppercase_ascii (gul14::string_view str)
 Return a copy of the given string in which all ASCII characters are replaced by their uppercase equivalents. More...
 
GUL_EXPORT std::string & uppercase_ascii_inplace (std::string &str) noexcept
 Replace all ASCII characters in a string by their uppercase equivalents. More...
 
std::string cat ()
 Efficiently concatenate an arbitrary number of strings and numbers. More...
 
std::string cat (const ConvertingStringView &s)
 
GUL_EXPORT std::string cat (const ConvertingStringView &s1, const ConvertingStringView &s2)
 
GUL_EXPORT std::string cat (const ConvertingStringView &s1, const ConvertingStringView &s2, const ConvertingStringView &s3)
 
GUL_EXPORT std::string cat (std::initializer_list< ConvertingStringView > pieces)
 
template<typename... Args, typename = std::enable_if_t<(sizeof...(Args) > 3)>>
std::string cat (const Args &... args)
 
GUL_EXPORT std::string escape (string_view in)
 Create a new string that looks like an ASCII-only C string literal of the input string. More...
 
GUL_EXPORT std::string unescape (string_view in)
 Evaluate a string with escaped characters to get the original string back. More...
 
template<typename F >
FinalAction< typename std::decay_t< F > > finally (F &&f) noexcept
 finally() - convenience function to generate a FinalAction More...
 
template<typename IntTypeA , typename IntTypeB >
constexpr auto gcd (IntTypeA a, IntTypeB b)
 Calculate the greatest common divisor of two integers using the Euclidean algorithm. More...
 
template<typename IntTypeA , typename IntTypeB >
constexpr auto lcm (IntTypeA a, IntTypeB b)
 Calculate the least common multiple of two integers. More...
 
template<typename IteratorT , typename = std::enable_if_t<detail::IsHexDumpIterator<IteratorT>::value>>
std::string hexdump (IteratorT begin, IteratorT end, string_view prompt="")
 Generate a hexdump of a data range and return it as a string. More...
 
template<typename ContainerT , typename = std::enable_if_t<detail::IsHexDumpContainer<ContainerT>::value>>
std::string hexdump (const ContainerT &cont, string_view prompt="")
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<typename IteratorT , typename = std::enable_if_t<detail::IsHexDumpIterator<IteratorT>::value>>
HexdumpParameterForward< const IteratorT > hexdump_stream (const IteratorT &begin, const IteratorT &end, std::string prompt="")
 Generate a hexdump of a data range that can be efficiently written to a stream using operator<<. More...
 
template<typename ContainerT , typename = std::enable_if_t<detail::IsHexDumpContainer<ContainerT>::value>>
HexdumpParameterForward< const decltype(std::declval< ContainerT >).cbegin())> hexdump_stream (const ContainerT &cont, std::string prompt="")
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<typename ContainerT , typename = std::enable_if_t<detail::IsHexDumpContainer<ContainerT>::value, decltype(HexdumpParameterForward<decltype(std::declval<ContainerT>().cbegin()), ContainerT> {}, 0)>>
HexdumpParameterForward< decltype(std::declval< ContainerT >).cbegin()), ContainerT > hexdump_stream (ContainerT &&cont, std::string prompt="")
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<typename StringContainer = std::vector<std::string>, typename ContainerInsertFct = void (*)(StringContainer&, string_view)>
StringContainer split (string_view text, string_view delimiter, ContainerInsertFct insert_fct=detail::emplace_back< StringContainer >)
 Separate a string at all occurrences of a delimiter, returning the strings between the delimiters in a container. More...
 
template<typename StringContainer = std::vector<std::string>, typename ContainerInsertFct = void (*)(StringContainer&, string_view)>
StringContainer split (string_view text, const std::regex &delimiter, ContainerInsertFct insert_fct=detail::emplace_back< StringContainer >)
 Separate a string at all occurrences of a delimiter described by a regular expression, returning the strings between the delimiters in a container. More...
 
template<typename StringContainer = std::vector<string_view>, typename ContainerInsertFct = void (*)(StringContainer&, string_view)>
StringContainer split_sv (string_view text, string_view delimiter, ContainerInsertFct insert_fct=detail::emplace_back< StringContainer >)
 Separate a string at all occurrences of a delimiter, returning the strings between the delimiters in a vector. More...
 
template<typename Iterator >
std::string join (Iterator begin, Iterator end, string_view glue)
 Concatenate all strings in a range, placing a delimiter between them. More...
 
template<typename StringContainer >
std::string join (const StringContainer &parts, string_view glue)
 Concatenate all strings in a range, placing a delimiter between them. More...
 
template<typename ValueT >
constexpr auto abs (ValueT n) noexcept -> std::enable_if_t< std::is_unsigned< ValueT >::value, ValueT >
 Compute the absolute value of a number. More...
 
template<typename NumT , typename OrderT , typename = std::enable_if_t< std::is_arithmetic<NumT>::value and std::is_arithmetic<OrderT>::value >>
bool within_orders (const NumT a, const NumT b, const OrderT orders) noexcept(false)
 Determine if two numbers are almost equal, comparing only some significant digits. More...
 
template<typename NumT >
bool within_abs (NumT a, NumT b, NumT tol) noexcept
 Determine if two numbers are almost equal, allowing for an absolute difference. More...
 
template<typename NumT , typename = std::enable_if_t<std::is_floating_point<NumT>::value>>
bool within_ulp (NumT a, NumT b, unsigned int ulp)
 Determine if two numbers are almost equal, allowing for a difference of a given number of units-in-the-last-place (ULPs). More...
 
template<class NumT >
constexpr const NumT & clamp (const NumT &v, const NumT &lo, const NumT &hi)
 Coerce a value to be within a given range. More...
 
template<class NumT , class Compare >
constexpr const NumT & clamp (const NumT &v, const NumT &lo, const NumT &hi, Compare comp)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
GUL_EXPORT std::string replace (string_view haystack, string_view needle, string_view hammer)
 Replace all occurrences of a string within another string, returning the result as a std::string. More...
 
GUL_EXPORT std::string & replace_inplace (std::string &haystack, string_view needle, string_view hammer)
 Replace all occurrences of a string within another string in-place. More...
 
template<typename ElementT , size_t in_capacity>
void swap (SmallVector< ElementT, in_capacity > &a, SmallVector< ElementT, in_capacity > &b)
 Exchange the contents of one SmallVector with those of another one. More...
 
template<typename ElementType , std::size_t Extent>
span< const unsigned char,((Extent==dynamic_extent) ? dynamic_extent :sizeof(ElementType) *Extent)> as_bytes (span< ElementType, Extent > s) noexcept
 Return a constant view to the byte representation of the elements of a given span. More...
 
template<class ElementType , size_t Extent, typename std::enable_if<!std::is_const< ElementType >::value, int >::type = 0>
span< unsigned char,((Extent==dynamic_extent) ? dynamic_extent :sizeof(ElementType) *Extent)> as_writable_bytes (span< ElementType, Extent > s) noexcept
 Return a writable view to the byte representation of the elements of a given span. More...
 
template<std::size_t N, typename E , std::size_t S>
constexpr auto get (span< E, S > s) -> decltype(s[N])
 Return a reference to the Nth element of a given span. More...
 
template<typename ElementT >
auto ElementAccessor ()
 Return a mock element accessor for containers. More...
 
template<typename ResultT = statistics_result_type, typename ContainerT , typename ElementT = typename ContainerT::value_type, typename Accessor = std::result_of_t<decltype(ElementAccessor<ElementT>())(ElementT)>(*)(ElementT const&), typename DataT = typename std::decay_t<std::result_of_t<Accessor(ElementT)>>, typename = std::enable_if_t<IsContainerLike<ContainerT>::value>>
auto mean (ContainerT const &container, Accessor accessor=ElementAccessor< ElementT >()) -> ResultT
 Calculate the arithmetic mean value of all elements in a container. More...
 
template<typename ResultT = statistics_result_type, typename ContainerT , typename ElementT = typename ContainerT::value_type, typename Accessor = std::result_of_t<decltype(ElementAccessor<ElementT>())(ElementT)>(*)(ElementT const&), typename DataT = typename std::decay_t<std::result_of_t<Accessor(ElementT)>>, typename = std::enable_if_t<IsContainerLike<ContainerT>::value>>
auto rms (ContainerT const &container, Accessor accessor=ElementAccessor< ElementT >()) -> ResultT
 Calculate the root mean square of all elements in a container. More...
 
template<typename ResultT = statistics_result_type, typename ContainerT , typename ElementT = typename ContainerT::value_type, typename Accessor = std::result_of_t<decltype(ElementAccessor<ElementT>())(ElementT)>(*)(ElementT const&), typename DataT = typename std::decay_t<std::result_of_t<Accessor(ElementT)>>, typename = std::enable_if_t<IsContainerLike<ContainerT>::value>>
auto median (ContainerT const &container, Accessor accessor=ElementAccessor< ElementT >()) -> ResultT
 Find the median of all elements in a container. More...
 
template<typename ContainerT , typename ElementT = typename ContainerT::value_type, typename Accessor = std::result_of_t<decltype(ElementAccessor<ElementT>())(ElementT)>(*)(ElementT const&), typename DataT = typename std::decay_t<std::result_of_t<Accessor(ElementT)>>, typename = std::enable_if_t<IsContainerLike<ContainerT>::value>>
auto maximum (ContainerT const &container, Accessor accessor=ElementAccessor< ElementT >()) -> DataT
 Return the maximum element value in a container. More...
 
template<typename ContainerT , typename ElementT = typename ContainerT::value_type, typename Accessor = std::result_of_t<decltype(ElementAccessor<ElementT>())(ElementT)>(*)(ElementT const&), typename DataT = typename std::decay_t<std::result_of_t<Accessor(ElementT)>>, typename = std::enable_if_t<IsContainerLike<ContainerT>::value>>
auto minimum (ContainerT const &container, Accessor accessor=ElementAccessor< ElementT >()) -> DataT
 Return the minimum element value in a container. More...
 
template<typename ContainerT , typename ElementT = typename ContainerT::value_type, typename Accessor = std::result_of_t<decltype(ElementAccessor<ElementT>())(ElementT)>(*)(ElementT const&), typename DataT = typename std::decay_t<std::result_of_t<Accessor(ElementT)>>, typename = std::enable_if_t<IsContainerLike<ContainerT>::value>>
auto min_max (ContainerT const &container, Accessor accessor=ElementAccessor< ElementT >()) -> MinMax< DataT >
 Find the minimum and maximum element values in a container. More...
 
template<typename ContainerT , typename ElementT = typename ContainerT::value_type, typename Accessor = std::result_of_t<decltype(ElementAccessor<ElementT>())(ElementT)>(*)(ElementT const&), typename DataT = typename std::decay_t<std::result_of_t<Accessor(ElementT)>>, typename = std::enable_if_t<IsContainerLike<ContainerT>::value>>
auto remove_outliers (ContainerT &&cont, std::size_t outliers, Accessor accessor=ElementAccessor< ElementT >()) -> ContainerT &
 Remove elements that are far away from other elements. More...
 
template<typename ContainerT , typename ElementT = typename ContainerT::value_type, typename Accessor = std::result_of_t<decltype(ElementAccessor<ElementT>())(ElementT)>(*)(ElementT const&), typename DataT = typename std::decay_t<std::result_of_t<Accessor(ElementT)>>, typename = std::enable_if_t<IsContainerLike<ContainerT>::value>>
auto remove_outliers (ContainerT const &cont, std::size_t outliers, Accessor accessor=ElementAccessor< ElementT >()) -> std::vector< ElementT >
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The original container is not modified. More...
 
template<typename ResultT = statistics_result_type, typename ContainerT , typename ElementT = typename ContainerT::value_type, typename Accessor = std::result_of_t<decltype(ElementAccessor<ElementT>())(ElementT)>(*)(ElementT const&), typename DataT = typename std::decay_t<std::result_of_t<Accessor(ElementT)>>, typename = std::enable_if_t<IsContainerLike<ContainerT>::value>>
auto standard_deviation (ContainerT const &container, Accessor accessor=ElementAccessor< ElementT >()) -> StandardDeviationMean< ResultT >
 Calculate the standard deviation of all elements in a container. More...
 
template<typename ResultT = statistics_result_type, typename ContainerT , typename ElementT = typename ContainerT::value_type, typename Accessor = std::result_of_t<decltype(ElementAccessor<ElementT>())(ElementT)>(*)(ElementT const&), typename DataT = typename std::decay_t<std::result_of_t<Accessor(ElementT)>>, typename OpClosure , typename = std::enable_if_t<IsContainerLike<ContainerT>::value>>
auto accumulate (ContainerT const &container, OpClosure op, Accessor accessor=ElementAccessor< ElementT >()) -> ResultT
 Calculate some aggregate value from all elements of a container. More...
 
template<typename ResultT = statistics_result_type, typename IteratorT , typename ElementT = std::decay_t<decltype(*std::declval<IteratorT>())>, typename Accessor = std::result_of_t<decltype(ElementAccessor<ElementT>())(ElementT)>(*)(ElementT const&), typename DataT = std::decay_t<std::result_of_t<Accessor(ElementT)>>>
auto mean (IteratorT const &begin, IteratorT const &end, Accessor accessor=ElementAccessor< ElementT >()) -> ResultT
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<typename ResultT = statistics_result_type, typename IteratorT , typename ElementT = std::decay_t<decltype(*std::declval<IteratorT>())>, typename Accessor = std::result_of_t<decltype(ElementAccessor<ElementT>())(ElementT)>(*)(ElementT const&), typename DataT = std::decay_t<std::result_of_t<Accessor(ElementT)>>>
auto rms (IteratorT const &begin, IteratorT const &end, Accessor accessor=ElementAccessor< ElementT >()) -> ResultT
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<typename ResultT = statistics_result_type, typename IteratorT , typename ElementT = std::decay_t<decltype(*std::declval<IteratorT>())>, typename Accessor = std::result_of_t<decltype(ElementAccessor<ElementT>())(ElementT)>(*)(ElementT const&), typename DataT = std::decay_t<std::result_of_t<Accessor(ElementT)>>>
auto median (IteratorT const &begin, IteratorT const &end, Accessor accessor=ElementAccessor< ElementT >()) -> ResultT
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<typename IteratorT , typename ElementT = std::decay_t<decltype(*std::declval<IteratorT>())>, typename Accessor = std::result_of_t<decltype(ElementAccessor<ElementT>())(ElementT)>(*)(ElementT const&), typename DataT = std::decay_t<std::result_of_t<Accessor(ElementT)>>>
auto maximum (IteratorT const &begin, IteratorT const &end, Accessor accessor=ElementAccessor< ElementT >()) -> DataT
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<typename IteratorT , typename ElementT = std::decay_t<decltype(*std::declval<IteratorT>())>, typename Accessor = std::result_of_t<decltype(ElementAccessor<ElementT>())(ElementT)>(*)(ElementT const&), typename DataT = std::decay_t<std::result_of_t<Accessor(ElementT)>>>
auto minimum (IteratorT const &begin, IteratorT const &end, Accessor accessor=ElementAccessor< ElementT >()) -> DataT
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<typename IteratorT , typename ElementT = std::decay_t<decltype(*std::declval<IteratorT>())>, typename Accessor = std::result_of_t<decltype(ElementAccessor<ElementT>())(ElementT)>(*)(ElementT const&), typename DataT = std::decay_t<std::result_of_t<Accessor(ElementT)>>>
auto min_max (IteratorT const &begin, IteratorT const &end, Accessor accessor=ElementAccessor< ElementT >()) -> MinMax< DataT >
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<typename IteratorT , typename ElementT = std::decay_t<decltype(*std::declval<IteratorT>())>, typename Accessor = std::result_of_t<decltype(ElementAccessor<ElementT>())(ElementT)>(*)(ElementT const&), typename DataT = std::decay_t<std::result_of_t<Accessor(ElementT)>>>
auto remove_outliers (IteratorT const &begin, IteratorT const &end, std::size_t outliers, Accessor accessor=ElementAccessor< ElementT >()) -> std::vector< ElementT >
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.The original container is not modified. More...
 
template<typename ResultT = statistics_result_type, typename IteratorT , typename ElementT = std::decay_t<decltype(*std::declval<IteratorT>())>, typename Accessor = std::result_of_t<decltype(ElementAccessor<ElementT>())(ElementT)>(*)(ElementT const&), typename DataT = std::decay_t<std::result_of_t<Accessor(ElementT)>>>
auto standard_deviation (IteratorT const &begin, IteratorT const &end, Accessor accessor=ElementAccessor< ElementT >()) -> StandardDeviationMean< ResultT >
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<typename ResultT = statistics_result_type, typename IteratorT , typename ElementT = std::decay_t<decltype(*std::declval<IteratorT>())>, typename Accessor = std::result_of_t<decltype(ElementAccessor<ElementT>())(ElementT)>(*)(ElementT const&), typename DataT = std::decay_t<std::result_of_t<Accessor(ElementT)>>, typename OpClosure >
auto accumulate (IteratorT const &begin, IteratorT const &end, OpClosure op, Accessor accessor=ElementAccessor< ElementT >()) -> ResultT
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<typename Integer , std::enable_if_t< std::is_integral< Integer >::value, bool > = true>
std::string hex_string (Integer v)
 Return the hexadecimal ASCII representation of an integer value. More...
 
template<typename Iterator >
std::string hex_string (Iterator begin, Iterator end, string_view separator="")
 Return the hexadecimal ASCII representation of a range of integer values. More...
 
template<typename Integer , size_t num_elements, std::enable_if_t< std::is_integral< Integer >::value, bool > = true>
std::string hex_string (const Integer(&array)[num_elements], string_view separator="")
 Return the hexadecimal ASCII representation of an array with integer values. More...
 
template<typename Container , std::enable_if_t< IsContainerLike< Container >::value, bool > = true>
std::string hex_string (const Container &container, string_view separator="")
 Return the hexadecimal ASCII representation of a container with integer values. More...
 
GUL_EXPORT std::string repeat (gul14::string_view str, std::size_t n)
 Repeat a string N times. More...
 
GUL_EXPORT std::string safe_string (const char *char_ptr, std::size_t length)
 Safely construct a std::string from a char pointer and a length. More...
 
constexpr bool contains (string_view haystack, string_view needle) noexcept
 Determine whether a string contains another string. More...
 
constexpr bool contains (string_view haystack, char needle) noexcept
 Determine whether a string contains a certain character. More...
 
constexpr bool ends_with (string_view str, string_view suffix) noexcept
 Determine whether a string ends with another string. More...
 
constexpr bool ends_with (string_view str, char c) noexcept
 Determine whether a string ends with a certain character. More...
 
constexpr bool starts_with (string_view str, string_view prefix) noexcept
 Determine whether a string starts with another string. More...
 
constexpr bool starts_with (string_view str, char c) noexcept
 Determine whether a string starts with a certain character. More...
 
constexpr bool equals_nocase (string_view str1, string_view str2) noexcept
 Determine whether a string is equal to another one, making no distinction between upper and lower case ASCII characters. More...
 
constexpr bool contains_nocase (string_view haystack, string_view needle) noexcept
 Determine whether a string contains another string. More...
 
constexpr bool contains_nocase (string_view haystack, char needle) noexcept
 Determine whether a string contains a certain character. More...
 
constexpr bool ends_with_nocase (string_view str, string_view suffix) noexcept
 Determine whether a string ends with another string. More...
 
constexpr bool ends_with_nocase (string_view str, char c) noexcept
 Determine whether a string ends with a certain character. More...
 
constexpr bool starts_with_nocase (string_view str, string_view prefix) noexcept
 Determine whether a string starts with another string. More...
 
constexpr bool starts_with_nocase (string_view str, char c) noexcept
 Determine whether a string starts with a certain character. More...
 
std::shared_ptr< ThreadPoolmake_thread_pool (std::size_t num_threads, std::size_t capacity=ThreadPool::default_capacity)
 Create a thread pool with the desired number of threads and the specified capacity for queuing tasks. More...
 
std::chrono::steady_clock::time_point tic ()
 Return the current time as a std::chrono time_point. More...
 
template<class TimeUnitType = std::chrono::duration<double>>
auto toc (std::chrono::steady_clock::time_point t0)
 Return the elapsed time in seconds (or a different unit) since the given time point. More...
 
template<class Rep , class Period >
bool sleep (const std::chrono::duration< Rep, Period > &duration, const Trigger &trg)
 Sleep for at least the given time span, with the option of being woken up from another thread. More...
 
bool sleep (double seconds, const Trigger &trg)
 Sleep for a given number of seconds, with the option of being woken up from another thread. More...
 
template<class Rep , class Period >
bool sleep (const std::chrono::duration< Rep, Period > &duration)
 Sleep for a given time span. More...
 
bool sleep (double seconds)
 Sleep for a given number of seconds. More...
 
template<typename NumberType >
constexpr std::enable_if_t< std::is_integral< NumberType >::value and std::is_unsigned< NumberType >::value, optional< NumberType > > to_number (gul14::string_view str) noexcept
 Convert an ASCII string_view into a number. More...
 
template<typename NumberType >
constexpr std::enable_if_t< std::is_integral< NumberType >::value and std::is_signed< NumberType >::value, optional< NumberType > > to_number (gul14::string_view str) noexcept
 
template<typename NumberType >
constexpr std::enable_if_t< std::is_floating_point< NumberType >::value, optional< NumberType > > to_number (gul14::string_view str) noexcept
 
template<>
constexpr optional< bool > to_number< bool > (gul14::string_view str) noexcept
 
template<typename StringContainer = std::vector<std::string>, typename ContainerInsertFct = void (*)(StringContainer&, string_view)>
StringContainer tokenize (string_view str, string_view delimiters=default_whitespace_characters, ContainerInsertFct insert_fct=detail::emplace_back< StringContainer >)
 Split the given string into a vector of substrings (tokens) delimited by any of the characters in the delimiters string. More...
 
template<typename StringContainer = std::vector<string_view>, typename ContainerInsertFct = void (*)(StringContainer&, string_view)>
StringContainer tokenize_sv (string_view str, string_view delimiters=default_whitespace_characters, ContainerInsertFct insert_fct=detail::emplace_back< StringContainer >)
 Split the given string into a vector of substrings (tokens) delimited by any of the characters in the delimiters string. More...
 
template<typename F , typename... Args>
constexpr auto invoke (F &&f, Args &&... args) noexcept(noexcept(detail_invoke::invoke(std::forward< F >(f), std::forward< Args >(args)...))) -> decltype(detail_invoke::invoke(std::forward< F >(f), std::forward< Args >(args)...))
 Invoke a callable object f with the given arguments. More...
 
GUL_EXPORT std::string trim (string_view str, string_view ws_chars=default_whitespace_characters)
 Trim leading and trailing whitespace (or a custom set of characters) from a string, returning a new std::string. More...
 
GUL_EXPORT string_view trim_sv (string_view str, string_view ws_chars=default_whitespace_characters)
 Trim leading and trailing whitespace (or a custom set of characters) from a string, returning a view into the original string. More...
 
GUL_EXPORT std::string trim_left (string_view str, string_view ws_chars=default_whitespace_characters)
 Trim leading whitespace (or a custom set of characters) from a string, returning a new std::string. More...
 
GUL_EXPORT string_view trim_left_sv (string_view str, string_view ws_chars=default_whitespace_characters)
 Trim leading whitespace (or a custom set of characters) from a string, returning a view into the original string. More...
 
GUL_EXPORT std::string trim_right (string_view str, string_view ws_chars=default_whitespace_characters)
 Trim trailing whitespace (or a custom set of characters) from a string, returning a new std::string. More...
 
GUL_EXPORT string_view trim_right_sv (string_view str, string_view ws_chars=default_whitespace_characters)
 Trim trailing whitespace (or a custom set of characters) from a string, returning a view into the original string. More...
 
template<class T >
constexpr string_view type_name ()
 Generate a human readable string describing a type. More...
 
constexpr bool operator< (monostate, monostate) noexcept
 
constexpr bool operator> (monostate, monostate) noexcept
 
constexpr bool operator<= (monostate, monostate) noexcept
 
constexpr bool operator>= (monostate, monostate) noexcept
 
constexpr bool operator== (monostate, monostate) noexcept
 
constexpr bool operator!= (monostate, monostate) noexcept
 
template<typename Visitor , typename... Variants>
constexpr decltype(auto) visit (Visitor &&visitor_fct, Variants &&... variants)
 Call a visitor function with the actual objects stored in the given variants. More...
 
template<typename... Fct>
auto make_overload_set (Fct... f)
 Create an OverloadSet from an arbitrary number of function objects. More...
 

Variables

GUL_EXPORT const string_view default_whitespace_characters { " \t\r\n\a\b\f\v" }
 The default characters that are treated as whitespace by GUL. More...
 
GUL_EXPORT const std::array< char, 16 > hex_digits
 The 16 digits for hexadecimal numbers ("0123456789abcdef"). More...
 
GUL_EXPORT char const * version_git
 Holds the git version tag of the sources that the library has been build with. More...
 
GUL_EXPORT char const * version_api
 Holds the API version of the library.
 

Variable Documentation

◆ version_git

GUL_EXPORT char const* gul14::version_git
extern

Holds the git version tag of the sources that the library has been build with.

It has the format returned by git describe –tags –always –dirty