The Sparta Modeling Framework
Loading...
Searching...
No Matches
TreeNodeExtensionsSupport.hpp
1#pragma once
2
3#include <type_traits>
4#include <vector>
5#include <string>
6#include <cstdint>
7
8namespace sparta::extensions {
9
10template <typename T>
11struct is_supported_scalar : std::false_type {};
12
13template <> struct is_supported_scalar<int8_t> : std::true_type {};
14template <> struct is_supported_scalar<uint8_t> : std::true_type {};
15template <> struct is_supported_scalar<int16_t> : std::true_type {};
16template <> struct is_supported_scalar<uint16_t> : std::true_type {};
17template <> struct is_supported_scalar<int32_t> : std::true_type {};
18template <> struct is_supported_scalar<uint32_t> : std::true_type {};
19template <> struct is_supported_scalar<int64_t> : std::true_type {};
20template <> struct is_supported_scalar<uint64_t> : std::true_type {};
21template <> struct is_supported_scalar<double> : std::true_type {};
22template <> struct is_supported_scalar<std::string> : std::true_type {};
23template <> struct is_supported_scalar<bool> : std::true_type {};
24
25template <typename T, size_t Depth>
27
28template <typename T, typename Alloc, size_t Depth>
29struct is_supported_impl<std::vector<T, Alloc>, Depth>
30 : std::conditional_t<
31 (Depth < 2),
32 is_supported_impl<T, Depth + 1>,
33 std::false_type
34 > {};
35
36template <typename T>
37struct is_supported : is_supported_impl<T, 0> {};
38
39} // namespace sparta::extensions