reglibcpp  1.7.0
(Naïve) C++ implementation of models for regular languages
utils.h
1 #ifndef REG_UTILS_H
2 #define REG_UTILS_H
3 #include <codecvt>
4 
5 #include <locale>
6 
7 #include <unordered_set>
8 
9 #include <functional>
10 
11 namespace reg {
12 
14 
19 template<class C,class T> size_t index_of(C const& container, T const& element) {
20  static_assert(std::is_same<typename C::value_type,T>::value, "C must be a container with T as value_type.");
21  return static_cast<size_t>(std::distance(container.begin(), std::find(container.begin(), container.end(), element)));
22 }
23 
25 } // namespace reg
26 #endif
std::wstring_convert< std::codecvt_utf8< char32_t >, char32_t > converter
Converts between UTF-8-encoded and UTF-32-encoded strings.
Definition: utils.cpp:4
size_t index_of(C const &container, T const &element)
Basically Java&#39;s List interface&#39;s indexOf, but as a non-member function and returning the container&#39;s...
Definition: utils.h:19
Where this library lives.
Definition: dfa.cpp:51