mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Data Structures | Namespaces | Functions
fn.hpp File Reference
#include <algorithm>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstring>
#include <ctime>
#include <filesystem>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <limits>
#include <memory>
#include <mutable/mutable-config.hpp>
#include <mutable/util/concepts.hpp>
#include <mutable/util/exception.hpp>
#include <mutable/util/macro.hpp>
#include <regex>
#include <sstream>
#include <type_traits>
#include <typeinfo>
#include <unistd.h>
#include <variant>
Include dependency graph for fn.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  m::StrHash
 Computes the FNV-1a 64-bit hash of a cstring. More...
 
struct  m::StrEqual
 Compares two cstrings for equality. More...
 
struct  m::StrEqualWithNull
 Compares two cstrings for equality. More...
 
struct  m::PairHash< T1, T2, H1, H2 >
 Computes the XOR-hash for a pair. More...
 
struct  m::overloaded< Ts >
 
struct  m::put_tm
 
struct  m::get_tm
 
struct  m::put_timepoint< Clock, Duration >
 
struct  m::Concat< std::variant< Args0... >, Args1... >
 
struct  m::is_streamable< S, T, typename >
 
struct  m::is_streamable< S, T, std::void_t< decltype(std::declval< S & >()<< std::declval< T >())> >
 
struct  m::lazy_construct< Factory >
 

Namespaces

namespace  m
 

‍mutable namespace


 

Functions

bool m::streq (const char *first, const char *second)
 
bool m::strneq (const char *first, const char *second, std::size_t n)
 
std::string m::replace_all (std::string str, const std::string &from, const std::string &to)
 
uint64_t m::FNV1a (const char *c_str)
 
uint64_t m::FNV1a (const char *c_str, std::size_t len)
 
template<typename T >
requires unsigned_integral<T>
M_EXPORT constexpr bool m::is_pow_2 (T n)
 
template<typename T , typename... Us>
T & m::get_as (std::variant< Us... > &v)
 
template<typename T , typename... Us>
const T & m::get_as (const std::variant< Us... > &v)
 
std::string m::escape (char c)
 
std::string M_EXPORT m::escape (const std::string &str, char esc='\\', char quote='"')
 
std::string M_EXPORT m::unescape (const std::string &str, char esc='\\', char quote='"')
 
std::string m::quote (const std::string &str)
 
std::string m::unquote (const std::string &str, char quote='"')
 
std::string m::interpret (const std::string &str, char esc='\\', char quote='"')
 
std::string M_EXPORT m::html_escape (std::string str)
 Escapes special characters in a string to be printable in HTML documents.
 
std::regex m::pattern_to_regex (const char *pattern, const bool optimize=false, const char escape_char='\\')
 Transforms a SQL-style LIKE pattern into a std::regex.
 
bool M_EXPORT m::like (const std::string &str, const std::string &pattern, const char escape_char='\\')
 Compares a SQL-style LIKE pattern with the given std::string.
 
template<typename H , typename N >
bool M_EXPORT m::contains (const H &haystack, const N &needle)
 Checks whether haystack contains needle.
 
template<typename T , typename U >
bool M_EXPORT m::equal (const T &first, const U &second)
 Checks whether first and second are equal considering permutations.
 
template<typename Container , typename Set >
bool M_EXPORT m::subset (const Container &subset, const Set &set)
 Checks whether subset is a subset of set.
 
template<typename Container , typename Set >
bool M_EXPORT m::intersect (const Container &first, const Set &second)
 Checks whether first and second intersect.
 
template<integral T, unsigned_integral U>
T M_EXPORT m::powi (const T base, const U exp)
 Power function for integral types.
 
template<typename T >
void M_EXPORT m::setbit (T *bytes, bool value, uint32_t n)
 
template<typename T , typename... Args>
std::ostream &M_EXPORT m::operator<< (std::ostream &out, const std::variant< T, Args... > value)
 
template<class... Ts>
 m::overloaded (Ts...) -> overloaded< Ts... >
 
uint64_t m::murmur3_64 (uint64_t v)
 This function implements the 64-bit finalizer of Murmur3_x64 by Austin Appleby, available at https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp .
 
bool m::is_oct (int c)
 
bool m::is_dec (int c)
 
bool m::is_hex (int c)
 
bool m::is_lower (int c)
 
bool m::is_upper (int c)
 
bool m::is_alpha (int c)
 
bool m::is_alnum (int c)
 
std::filesystem::path m::get_home_path ()
 Returns path of the user's home directory.
 
bool m::isspace (const char *s, std::size_t len)
 Returns true iff the character sequence only consists of white spaces.
 
bool m::isspace (const char *s)
 
void M_EXPORT m::exec (const char *executable, std::initializer_list< const char * > args)
 
template<typename T , typename U >
auto M_EXPORT m::add_wo_overflow (T left, U right)
 
template<typename N0 , typename N1 >
auto M_EXPORT m::sum_wo_overflow (N0 n0, N1 n1)
 
template<typename N0 , typename N1 , typename... Numbers>
auto M_EXPORT m::sum_wo_overflow (N0 n0, N1 n1, Numbers... numbers)
 Returns the sum of the given parameters.
 
template<typename T , typename U >
auto M_EXPORT m::mul_wo_overflow (T left, U right)
 
template<typename N0 , typename N1 >
auto M_EXPORT m::prod_wo_overflow (N0 n0, N1 n1)
 
template<typename N0 , typename N1 , typename... Numbers>
auto M_EXPORT m::prod_wo_overflow (N0 n0, N1 n1, Numbers... numbers)
 Returns the product of the given parameters.
 
const char * m::strdupn (const char *str)
 A wrapper around strdup() that permits nullptr.
 
std::size_t M_EXPORT m::get_pagesize ()
 Returns the page size of the system.
 
std::size_t m::Is_Page_Aligned (std::size_t n)
 Returns true iff n is a integral multiple of the page size (in bytes).
 
std::size_t m::Ceil_To_Next_Page (std::size_t n)
 Returns the smallest integral multiple of the page size (in bytes) greater than or equals to n.
 
uint64_t m::sequence_number (double x)
 This function assigns an integral sequence number to each double that is not NaN, such that if y = std::nextafter(x, INF) then sequence_number(y) = sequence_number(x) + 1.
 
uint32_t m::sequence_number (float x)
 This function assigns an integral sequence number to each float that is not NaN, such that if y = std::nextafter(x, INF) then sequence_number(y) = sequence_number(x) + 1.
 
template<typename T >
constexpr bool M_EXPORT m::is_range_wide_enough (T a, T b, std::size_t n)
 Checks whether the range [a, b] contains at least n distinct values.
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, unsigned long long > M_EXPORT m::n_choose_k_approx (T n, T k)
 Approximates n! using the gamma function.
 
float m::fast_reciprocal_sqrtf (const float n)
 Fast reciprocal square root, that became famous in Quake 3.
 
float m::fast_reciprocal_sqrt (const float n)
 
double m::fast_reciprocal_sqrtd (const double n)
 Fast reciprocal square root, that became famous in Quake 3.
 
double m::fast_reciprocal_sqrt (const double n)
 
float m::fast_sqrtf (float n)
 
float m::fast_sqrt (float n)
 
double m::fast_sqrtd (double n)
 
double m::fast_sqrt (double n)