1#ifndef CHITECH_CHI_UTILS_H
2#define CHITECH_CHI_UTILS_H
14 size_t total_num_iterations,
15 unsigned int num_intvls = 10);
33std::vector<std::string>
StringSplit(
const std::string& input,
34 const std::string& delim =
" ");
39 const std::string& search_string);
43template <
typename T,
typename B>
46 return std::find(list.begin(), list.end(), val) != list.end();
60std::vector<SubSetInfo>
MakeSubSets(
size_t num_items,
61 size_t desired_num_subsets);
64inline constexpr uint32_t
hash_djb2a(
const std::string_view sv)
67 for (
unsigned char c : sv)
68 hash = ((hash << 5) + hash) ^ c;
73inline constexpr uint32_t
operator"" _hash(
const char* str,
size_t len)
81 output_file.write((
char*)&value,
sizeof(T));
87 input_file.read((
char*)&value,
sizeof(T));
std::string StringUpToFirstReverse(const std::string &input, const std::string &search_string)
constexpr uint32_t hash_djb2a(const std::string_view sv)
std::string PrintIterationProgress(size_t current_iteration, size_t total_num_iterations, unsigned int num_intvls=10)
const std::string WHITESPACE
std::vector< SubSetInfo > MakeSubSets(size_t num_items, size_t desired_num_subsets)
T ReadBinaryValue(std::ifstream &input_file)
void AssertReadibleFile(const std::string &file_name)
std::string StringLTrim(const std::string &s)
std::vector< std::string > StringSplit(const std::string &input, const std::string &delim)
bool VectorListHas(const std::vector< T > &list, const B &val)
void WriteBinaryValue(std::ofstream &output_file, T value)
std::string StringRTrim(const std::string &s)
std::string StringTrim(const std::string &s)