powerd++  0.4.4
Classes | Namespaces | Macros | Functions
utility.hpp File Reference

Implements generally useful functions. More...

#include <type_traits>
#include <charconv>
#include <cctype>
#include <string>
#include <cstdio>
Include dependency graph for utility.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  utility::Formatter< BufSize >
 A formatting wrapper around string literals. More...
 
class  utility::Sum< T >
 A simple value container only allowing += and copy assignment. More...
 
class  utility::Min< T >
 A simple value container that provides the minimum of assigned values. More...
 
class  utility::Max< T >
 A simple value container that provides the maximum of assigned values. More...
 
struct  utility::FromChars
 A functor for reading numerical values from a string or character array. More...
 
struct  utility::Underlined
 A line of text and an underlining line. More...
 

Namespaces

 utility
 A collection of generally useful functions.
 
 utility::literals
 Contains literal operators.
 

Functions

template<typename T , size_t Count>
constexpr size_t utility::countof (T(&)[Count])
 Like sizeof(), but it returns the number of elements an array consists of instead of the number of bytes. More...
 
template<typename... Args>
void utility::sprintf (Args...)
 This is a safeguard against accidentally using sprintf(). More...
 
template<size_t Size, typename... Args>
int utility::sprintf_safe (char(&dst)[Size], char const *const format, Args const ... args)
 A wrapper around snprintf() that automatically pulls in the destination buffer size. More...
 
template<class ET , typename VT = typename std::underlying_type<ET>::type>
constexpr VT utility::to_value (ET const op)
 Casts an enum to its underlying value. More...
 
constexpr Formatter< 16384 > utility::literals::operator""_fmt (char const *const fmt, size_t const)
 Literal to convert a string literal to a Formatter instance. More...
 
Underlined utility::highlight (std::string const &str, ptrdiff_t const offs, ptrdiff_t const len=1)
 Underline the given number of characters. More...
 

Detailed Description

Implements generally useful functions.