suanPan
Loading...
Searching...
No Matches
utility.h File Reference
#include <concepts>
#include <suanPan.h>
Include dependency graph for utility.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  suanpan
 
namespace  suanpan::expression
 

Functions

template<sp_i IT, std::invocable< IT > F>
void suanpan::for_each (const IT start, const IT end, F &&FN)
 
template<sp_i IT, std::invocable< IT > F>
void suanpan::for_each (const IT end, F &&FN)
 
template<typename T >
constexpr T suanpan::max_element (T start, T end)
 
template<typename T >
const std::vector< T > & suanpan::unique (std::vector< T > &container)
 
template<typename T >
constexpr Tsuanpan::hacker (const T &I)
 
template<typename T >
constexpr T *& suanpan::hacker (const T *const &I)
 
template<typename T >
T suanpan::sign (const T &I)
 
template<typename T >
constexpr T suanpan::clamp (T c, T a, T b)
 
template<typename T >
constexpr T suanpan::clamp_unit (T c)
 
template<typename T >
requires (!std::numeric_limits<T>::is_integer)
bool suanpan::approx_equal (T x, T y, int ulp=2)
 
unsigned long long suanpan::binomial (unsigned long long, unsigned long long)
 
char suanpan::to_upper (char)
 
char suanpan::to_lower (char)
 
void suanpan::to_upper (std::string &)
 
void suanpan::to_lower (std::string &)
 
std::string suanpan::to_upper (const std::string &)
 
std::string suanpan::to_lower (const std::string &)
 
std::string suanpan::to_upper (std::string &&)
 
std::string suanpan::to_lower (std::string &&)
 
std::vector< std::pair< std::string, unsigned > > suanpan::expression::split (std::string_view variable_string)
 
template<typename T >
bool get_input (std::istringstream &I, T &O)
 
template<typename T >
bool get_input (std::istringstream &I, Col< T > &O)
 
template<typename T , typename... U>
bool get_input (std::istringstream &I, T &O, U &... R)
 
template<typename T >
T get_input (std::istringstream &I)
 
void ignore_whitespace (std::istringstream &)
 
template<typename T >
bool get_optional_input (std::istringstream &I, T &O)
 
template<typename T >
bool get_optional_input (std::istringstream &I, Col< T > &O)
 
template<typename T , typename... U>
bool get_optional_input (std::istringstream &I, T &O, U &... R)
 
template<typename T >
auto get_remaining (std::istringstream &I)
 
template<typename T1 , typename T2 >
auto get_remaining (std::istringstream &I)
 
template<typename T1 , typename T2 , typename T3 >
auto get_remaining (std::istringstream &I)
 
template<typename T1 , typename T2 , typename T3 , typename T4 >
auto get_remaining (std::istringstream &I)
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
auto get_remaining (std::istringstream &I)
 
std::string get_remaining (std::istringstream &)
 
bool is_equal (const char *, const char *)
 
bool is_equal (char, char)
 
bool is_equal (int, char)
 
bool is_equal (const std::string &, const char *)
 
bool is_equal (const char *, const std::string &)
 
bool is_equal (const std::string &, const std::string &)
 
bool is_equal (std::string_view, const char *)
 
bool is_equal (const char *, std::string_view)
 
bool if_contain (const std::string &, const char *)
 
bool if_contain (const std::string &, const std::string &)
 
bool if_contain (std::string &&, std::string &&)
 
bool if_startswith (std::string_view, std::string_view)
 
template<std::equality_comparable T>
std::pair< bool, std::int64_t > if_contain (const std::vector< T > &container, const T target)
 
bool is_true (const char *)
 
bool is_false (const char *)
 
bool is_true (const std::string &)
 
bool is_false (const std::string &)
 
bool is_integer (const std::string &)
 
double perturb (double, double=1E-5)
 

Function Documentation

◆ get_input() [1/4]

template<typename T >
T get_input ( std::istringstream &  I)

◆ get_input() [2/4]

template<typename T >
bool get_input ( std::istringstream &  I,
Col< T > &  O 
)

◆ get_input() [3/4]

template<typename T >
bool get_input ( std::istringstream &  I,
T O 
)
Here is the caller graph for this function:

◆ get_input() [4/4]

template<typename T , typename... U>
bool get_input ( std::istringstream &  I,
T O,
U &...  R 
)
Here is the call graph for this function:

◆ get_optional_input() [1/3]

template<typename T >
bool get_optional_input ( std::istringstream &  I,
Col< T > &  O 
)

◆ get_optional_input() [2/3]

template<typename T >
bool get_optional_input ( std::istringstream &  I,
T O 
)
Here is the caller graph for this function:

◆ get_optional_input() [3/3]

template<typename T , typename... U>
bool get_optional_input ( std::istringstream &  I,
T O,
U &...  R 
)
Here is the call graph for this function:

◆ get_remaining() [1/6]

std::string get_remaining ( std::istringstream &  I)
Here is the caller graph for this function:

◆ get_remaining() [2/6]

template<typename T >
auto get_remaining ( std::istringstream &  I)
Here is the call graph for this function:

◆ get_remaining() [3/6]

template<typename T1 , typename T2 >
auto get_remaining ( std::istringstream &  I)
Here is the call graph for this function:

◆ get_remaining() [4/6]

template<typename T1 , typename T2 , typename T3 >
auto get_remaining ( std::istringstream &  I)
Here is the call graph for this function:

◆ get_remaining() [5/6]

template<typename T1 , typename T2 , typename T3 , typename T4 >
auto get_remaining ( std::istringstream &  I)
Here is the call graph for this function:

◆ get_remaining() [6/6]

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
auto get_remaining ( std::istringstream &  I)
Here is the call graph for this function:

◆ if_contain() [1/4]

bool if_contain ( const std::string &  A,
const char *  B 
)
Here is the caller graph for this function:

◆ if_contain() [2/4]

bool if_contain ( const std::string &  A,
const std::string &  B 
)

◆ if_contain() [3/4]

template<std::equality_comparable T>
std::pair< bool, std::int64_t > if_contain ( const std::vector< T > &  container,
const T  target 
)

◆ if_contain() [4/4]

bool if_contain ( std::string &&  A,
std::string &&  B 
)
Here is the call graph for this function:

◆ if_startswith()

bool if_startswith ( std::string_view  A,
std::string_view  B 
)
Here is the caller graph for this function:

◆ ignore_whitespace()

void ignore_whitespace ( std::istringstream &  I)
Here is the call graph for this function:

◆ is_equal() [1/8]

bool is_equal ( char  A,
char  B 
)

◆ is_equal() [2/8]

bool is_equal ( const char *  A,
const char *  B 
)
Here is the caller graph for this function:

◆ is_equal() [3/8]

bool is_equal ( const char *  A,
const std::string &  B 
)
Here is the call graph for this function:

◆ is_equal() [4/8]

bool is_equal ( const char *  A,
std::string_view  B 
)
Here is the call graph for this function:

◆ is_equal() [5/8]

bool is_equal ( const std::string &  A,
const char *  B 
)
Here is the call graph for this function:

◆ is_equal() [6/8]

bool is_equal ( const std::string &  A,
const std::string &  B 
)
Here is the call graph for this function:

◆ is_equal() [7/8]

bool is_equal ( int  A,
char  B 
)

◆ is_equal() [8/8]

bool is_equal ( std::string_view  A,
const char *  B 
)
Here is the call graph for this function:

◆ is_false() [1/2]

bool is_false ( const char *  S)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_false() [2/2]

bool is_false ( const std::string &  S)
Here is the call graph for this function:

◆ is_integer()

bool is_integer ( const std::string &  S)
Here is the caller graph for this function:

◆ is_true() [1/2]

bool is_true ( const char *  S)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_true() [2/2]

bool is_true ( const std::string &  S)
Here is the call graph for this function:

◆ perturb()

double perturb ( double  input,
double  fraction = 1E-5 
)