13 #ifndef MLPACK_CORE_DATA_TOKENIZERS_SPLIT_BY_ANY_OF_HPP 14 #define MLPACK_CORE_DATA_TOKENIZERS_SPLIT_BY_ANY_OF_HPP 33 using MaskType = std::array<bool, 1 << CHAR_BIT>;
44 for (
char symbol : delimiters)
45 mask[
static_cast<unsigned char>(symbol)] =
true;
58 while (retval.empty())
60 const std::size_t pos = FindFirstDelimiter(str);
67 retval = str.substr(0, pos);
68 str.remove_prefix(pos + 1);
98 for (
size_t pos = 0; pos < str.size(); pos++)
100 if (mask[static_cast<unsigned char>(str[pos])])
MaskType & Mask()
Modify the mask.
Definition: split_by_any_of.hpp:86
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The core includes that mlpack expects; standard C++ includes and Armadillo.
std::array< bool, 1<< CHAR_BIT > MaskType
A convenient alias for the mask type.
Definition: split_by_any_of.hpp:33
SplitByAnyOf(const boost::string_view delimiters)
Construct the object from the given delimiters.
Definition: split_by_any_of.hpp:40
const MaskType & Mask() const
Return the mask.
Definition: split_by_any_of.hpp:84
Definition: string_view.hpp:60
boost::string_view operator()(boost::string_view &str) const
The function extracts the first token from the given string view and then removes the prefix containi...
Definition: split_by_any_of.hpp:54
static bool IsTokenEmpty(const boost::string_view token)
The function returns true if the given token is empty.
Definition: split_by_any_of.hpp:78
The SplitByAnyOf class tokenizes a string using a set of delimiters.
Definition: split_by_any_of.hpp:26