suanPan
utility.h File Reference
#include <suanPan.h>
#include <concepts>
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 T & suanpan::hacker (const T &I)
 
template<typename T >
constexpr T *& suanpan::hacker (const T *const &I)
 
template<typename T >
suanpan::sign (const T &I)
 
template<typename T >
std::enable_if_t<!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 (string &)
 
void suanpan::to_lower (string &)
 
string suanpan::to_upper (const string &)
 
string suanpan::to_lower (const string &)
 
string suanpan::to_upper (string &&)
 
string suanpan::to_lower (string &&)
 
std::vector< std::pair< string, unsigned > > suanpan::expression::split (const std::string_view &variable_string)
 
template<typename T >
bool get_input (istringstream &I, T &O)
 
template<typename T >
bool get_input (istringstream &I, Col< T > &O)
 
template<typename T >
bool get_input (istringstream &I, std::vector< T > &O)
 
template<typename T , typename... U>
bool get_input (istringstream &I, T &O, U &... R)
 
template<typename T >
get_input (istringstream &I)
 
void ignore_whitespace (istringstream &)
 
template<typename T >
bool get_optional_input (istringstream &I, T &O)
 
template<typename T >
bool get_optional_input (istringstream &I, Col< T > &O)
 
template<typename T , typename... U>
bool get_optional_input (istringstream &I, T &O, U &... R)
 
string get_remaining (istringstream &)
 
bool is_equal (const char *, const char *)
 
bool is_equal (char, char)
 
bool is_equal (int, char)
 
bool is_equal (const string &, const char *)
 
bool is_equal (const char *, const string &)
 
bool is_equal (const string &, const string &)
 
bool if_contain (const string &, const char *)
 
bool if_contain (const string &, const string &)
 
bool if_contain (string &&, string &&)
 
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 string &)
 
bool is_false (const string &)
 
bool is_integer (const string &)
 
double perturb (double, double=1E-5)
 

Function Documentation

◆ get_input() [1/5]

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

◆ get_input() [2/5]

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

◆ get_input() [3/5]

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

◆ get_input() [4/5]

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

◆ get_input() [5/5]

template<typename T , typename... U>
bool get_input ( 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 ( istringstream &  I,
Col< T > &  O 
)

◆ get_optional_input() [2/3]

template<typename T >
bool get_optional_input ( 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 ( istringstream &  I,
T &  O,
U &...  R 
)
Here is the call graph for this function:

◆ get_remaining()

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

◆ if_contain() [1/4]

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

◆ if_contain() [2/4]

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

◆ if_contain() [3/4]

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

◆ if_contain() [4/4]

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

◆ ignore_whitespace()

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

◆ is_equal() [1/6]

bool is_equal ( char  A,
char  B 
)

◆ is_equal() [2/6]

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

◆ is_equal() [3/6]

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

◆ is_equal() [4/6]

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

◆ is_equal() [5/6]

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

◆ is_equal() [6/6]

bool is_equal ( int  A,
char  B 
)

◆ 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 string &  S)
Here is the call graph for this function:

◆ is_integer()

bool is_integer ( const 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 string &  S)
Here is the call graph for this function:

◆ perturb()

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