OSSIA
Open Scenario System for Interactive Application
small_vector.hpp
1 #pragma once
2 #include <ossia/detail/config.hpp>
3 
4 #include <ossia/detail/pod_vector.hpp>
5 
6 #if defined(_GLIBCXX_DEBUG)
7 #define OSSIA_NO_SMALLVECTOR
8 #elif defined(_LIBCPP_DEBUG_LEVEL) && _LIBCPP_DEBUG_LEVEL > 0
9 #define OSSIA_NO_SMALLVECTOR
10 #elif defined(_ITERATOR_DEBUG_LEVEL) && _ITERATOR_DEBUG_LEVEL > 0
11 #define OSSIA_NO_SMALLVECTOR
12 #endif
13 
14 #if !defined(OSSIA_NO_SMALLVECTOR)
15 #define OSSIA_SMALL_VECTOR
16 #include <boost/container/small_vector.hpp>
17 #include <boost/container/static_vector.hpp>
18 #include <boost/version.hpp>
19 
20 namespace ossia
21 {
22 template <typename T, std::size_t N>
23 using small_vector = boost::container::small_vector<T, N>;
24 template <typename T, std::size_t N>
25 using small_pod_vector = boost::container::small_vector<T, N, pod_allocator<T>>;
26 template <typename T, std::size_t N>
27 using static_vector = boost::container::static_vector<T, N>;
28 }
29 #else
30 namespace ossia
31 {
32 template <typename T, std::size_t N>
33 using small_vector = std::vector<T>;
34 template <typename T, std::size_t N>
35 using small_pod_vector = pod_vector<T>;
36 template <typename T, std::size_t N>
37 using static_vector = std::vector<T>;
38 }
39 #endif
40 
41 #if BOOST_VERSION >= 107200
42 static_assert(noexcept(ossia::small_vector<int, 1>{}));
43 static_assert(noexcept(ossia::small_pod_vector<int, 1>{}));
44 static_assert(noexcept(ossia::static_vector<int, 1>{}));
45 #endif
Definition: git_info.h:7