Xiangiqgame
AI engine for Xiangqi
Loading...
Searching...
No Matches
utility_functs Namespace Reference

Free functions that don't clearly belong in any other namespace. More...

Functions

template<typename T >
random (T range_from, T range_to)
 
bool ends_with (string const &value, string const &ending)
 
template<typename FromKey , typename ToKey , typename Value >
unordered_map< ToKey, Value > replace_keys (unordered_map< FromKey, Value > orig_map, std ::unordered_map< FromKey, ToKey > key_substitutions)
 
template<typename FromKey , typename ToKey , typename Value >
unordered_map< ToKey, Value > replace_keys_forward (unordered_map< FromKey, Value > orig_map, unordered_map< FromKey, ToKey > key_substitutions)
 
template<typename FromKey , typename ToKey , typename Value >
unordered_map< ToKey, Value > replace_keys_reverse (unordered_map< FromKey, Value > orig_map, unordered_map< ToKey, FromKey > key_substitutions)
 
template<typename two_d_array_t >
two_d_array_t vertical_flip_array (two_d_array_t orig_array)
 
template<typename two_d_array_t >
two_d_array_t two_array_sum (two_d_array_t a, two_d_array_t b)
 
template<typename two_d_array_t , typename array_element_t >
two_d_array_t array_plus_const (two_d_array_t array, array_element_t offset)
 
template<typename two_d_array_t , typename array_element_t >
bool operator== (two_d_array_t &a, two_d_array_t &b)
 
template<typename T >
bool hasRepeatingPattern (const std::vector< T > &vec, int lookback_length, int period)
 
template<typename T , typename M >
std::vector< T >::const_iterator find_by_member (const std::vector< T > &vec, M T::*member, const M &value)
 
const string get_data_file_abs_path (const std::string data_file)
 

Detailed Description

Free functions that don't clearly belong in any other namespace.

Function Documentation

◆ array_plus_const()

template<typename two_d_array_t , typename array_element_t >
two_d_array_t utility_functs::array_plus_const ( two_d_array_t  array,
array_element_t  offset 
)

Definition at line 93 of file utility_functs.hpp.

◆ ends_with()

bool utility_functs::ends_with ( string const &  value,
string const &  ending 
)
inline

Definition at line 28 of file utility_functs.hpp.

◆ find_by_member()

template<typename T , typename M >
std::vector< T >::const_iterator utility_functs::find_by_member ( const std::vector< T > &  vec,
M T::*  member,
const M &  value 
)

Definition at line 149 of file utility_functs.hpp.

◆ get_data_file_abs_path()

const std::string utility_functs::get_data_file_abs_path ( const std::string  data_file)

Definition at line 9 of file utility_functs.cpp.

◆ hasRepeatingPattern()

template<typename T >
bool utility_functs::hasRepeatingPattern ( const std::vector< T > &  vec,
int  lookback_length,
int  period 
)

Definition at line 119 of file utility_functs.hpp.

◆ operator==()

template<typename two_d_array_t , typename array_element_t >
bool utility_functs::operator== ( two_d_array_t &  a,
two_d_array_t &  b 
)

Definition at line 104 of file utility_functs.hpp.

◆ random()

template<typename T >
T utility_functs::random ( range_from,
range_to 
)

Definition at line 21 of file utility_functs.hpp.

◆ replace_keys()

template<typename FromKey , typename ToKey , typename Value >
unordered_map< ToKey, Value > utility_functs::replace_keys ( unordered_map< FromKey, Value >  orig_map,
std ::unordered_map< FromKey, ToKey >  key_substitutions 
)

Definition at line 35 of file utility_functs.hpp.

◆ replace_keys_forward()

template<typename FromKey , typename ToKey , typename Value >
unordered_map< ToKey, Value > utility_functs::replace_keys_forward ( unordered_map< FromKey, Value >  orig_map,
unordered_map< FromKey, ToKey >  key_substitutions 
)

Definition at line 49 of file utility_functs.hpp.

◆ replace_keys_reverse()

template<typename FromKey , typename ToKey , typename Value >
unordered_map< ToKey, Value > utility_functs::replace_keys_reverse ( unordered_map< FromKey, Value >  orig_map,
unordered_map< ToKey, FromKey >  key_substitutions 
)

Definition at line 63 of file utility_functs.hpp.

◆ two_array_sum()

template<typename two_d_array_t >
two_d_array_t utility_functs::two_array_sum ( two_d_array_t  a,
two_d_array_t  b 
)

Definition at line 82 of file utility_functs.hpp.

◆ vertical_flip_array()

template<typename two_d_array_t >
two_d_array_t utility_functs::vertical_flip_array ( two_d_array_t  orig_array)

Definition at line 75 of file utility_functs.hpp.