From 38818fbe3d850fdb02636a71a424dddcd44820d2 Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Tue, 20 Feb 2018 18:32:22 +0300 Subject: [PATCH] Add limits precheck --- .../fusion/container/deque/detail/cpp03/as_deque.hpp | 8 +++++++- .../boost/fusion/container/map/detail/cpp03/as_map.hpp | 8 +++++++- .../boost/fusion/container/set/detail/cpp03/as_set.hpp | 8 +++++++- .../fusion/container/vector/detail/cpp03/as_vector.hpp | 8 +++++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/include/boost/fusion/container/deque/detail/cpp03/as_deque.hpp b/include/boost/fusion/container/deque/detail/cpp03/as_deque.hpp index e95daf3a..860a2a29 100644 --- a/include/boost/fusion/container/deque/detail/cpp03/as_deque.hpp +++ b/include/boost/fusion/container/deque/detail/cpp03/as_deque.hpp @@ -26,7 +26,13 @@ namespace boost { namespace fusion { namespace detail BOOST_FUSION_BARRIER_BEGIN template - struct as_deque; + struct as_deque + { + BOOST_STATIC_ASSERT_MSG( + size <= FUSION_MAX_DEQUE_SIZE + , "FUSION_MAX_DEQUE_SIZE limit is too low" + ); + }; template <> struct as_deque<0> diff --git a/include/boost/fusion/container/map/detail/cpp03/as_map.hpp b/include/boost/fusion/container/map/detail/cpp03/as_map.hpp index efa836ba..442c350c 100644 --- a/include/boost/fusion/container/map/detail/cpp03/as_map.hpp +++ b/include/boost/fusion/container/map/detail/cpp03/as_map.hpp @@ -25,7 +25,13 @@ namespace boost { namespace fusion { namespace detail BOOST_FUSION_BARRIER_BEGIN template - struct as_map; + struct as_map + { + BOOST_STATIC_ASSERT_MSG( + size <= FUSION_MAX_MAP_SIZE + , "FUSION_MAX_MAP_SIZE limit is too low" + ); + }; template struct as_map<0, is_assoc> diff --git a/include/boost/fusion/container/set/detail/cpp03/as_set.hpp b/include/boost/fusion/container/set/detail/cpp03/as_set.hpp index c9159314..ec73a158 100644 --- a/include/boost/fusion/container/set/detail/cpp03/as_set.hpp +++ b/include/boost/fusion/container/set/detail/cpp03/as_set.hpp @@ -25,7 +25,13 @@ namespace boost { namespace fusion { namespace detail BOOST_FUSION_BARRIER_BEGIN template - struct as_set; + struct as_set + { + BOOST_STATIC_ASSERT_MSG( + size <= FUSION_MAX_SET_SIZE + , "FUSION_MAX_SET_SIZE limit is too low" + ); + }; template <> struct as_set<0> diff --git a/include/boost/fusion/container/vector/detail/cpp03/as_vector.hpp b/include/boost/fusion/container/vector/detail/cpp03/as_vector.hpp index bd7fa76b..471f7840 100644 --- a/include/boost/fusion/container/vector/detail/cpp03/as_vector.hpp +++ b/include/boost/fusion/container/vector/detail/cpp03/as_vector.hpp @@ -25,7 +25,13 @@ namespace boost { namespace fusion { namespace detail BOOST_FUSION_BARRIER_BEGIN template - struct as_vector; + struct as_vector + { + BOOST_STATIC_ASSERT_MSG( + size <= FUSION_MAX_VECTOR_SIZE + , "FUSION_MAX_VECTOR_SIZE limit is too low" + ); + }; template <> struct as_vector<0>