draconisplusplus/include/rfl/parsing/is_vector_like.hpp

54 lines
1.3 KiB
C++
Raw Normal View History

2024-05-31 22:59:00 -04:00
#ifndef RFL_PARSING_IS_VECTOR_LIKE_HPP_
#define RFL_PARSING_IS_VECTOR_LIKE_HPP_
#include <deque>
#include <forward_list>
#include <list>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
namespace rfl {
2024-06-08 14:10:59 -04:00
namespace parsing {
2024-05-31 22:59:00 -04:00
2024-06-08 14:10:59 -04:00
template <class T>
class is_vector_like;
2024-05-31 22:59:00 -04:00
2024-06-08 14:10:59 -04:00
template <class T>
class is_vector_like : public std::false_type {};
2024-05-31 22:59:00 -04:00
2024-06-08 14:10:59 -04:00
template <class T>
class is_vector_like<std::deque<T>> : public std::true_type {};
2024-05-31 22:59:00 -04:00
2024-06-08 14:10:59 -04:00
template <class T>
class is_vector_like<std::forward_list<T>> : public std::true_type {};
2024-05-31 22:59:00 -04:00
2024-06-08 14:10:59 -04:00
template <class T>
class is_vector_like<std::list<T>> : public std::true_type {};
2024-05-31 22:59:00 -04:00
2024-06-08 14:10:59 -04:00
template <class T>
class is_vector_like<std::multiset<T>> : public std::true_type {};
2024-05-31 22:59:00 -04:00
2024-06-08 14:10:59 -04:00
template <class T>
class is_vector_like<std::set<T>> : public std::true_type {};
2024-05-31 22:59:00 -04:00
2024-06-08 14:10:59 -04:00
template <class T>
class is_vector_like<std::unordered_multiset<T>> : public std::true_type {};
2024-05-31 22:59:00 -04:00
2024-06-08 14:10:59 -04:00
template <class T>
class is_vector_like<std::unordered_set<T>> : public std::true_type {};
2024-05-31 22:59:00 -04:00
2024-06-08 14:10:59 -04:00
template <class T>
class is_vector_like<std::vector<T>> : public std::true_type {};
2024-05-31 22:59:00 -04:00
2024-06-08 14:10:59 -04:00
template <class T>
constexpr bool is_vector_like_v =
2024-06-16 00:13:15 -04:00
is_vector_like<std::remove_cvref_t<std::remove_pointer_t<T>>>::value;
2024-05-31 22:59:00 -04:00
2024-06-08 14:10:59 -04:00
} // namespace parsing
} // namespace rfl
2024-05-31 22:59:00 -04:00
#endif