3 boost/numeric/odeint/util/is_resizeable.hpp
6 Metafunction to determine if a state type can resized. For usage in the steppers.
9 Copyright 2011-2012 Karsten Ahnert
10 Copyright 2011 Mario Mulansky
12 Distributed under the Boost Software License, Version 1.0.
13 (See accompanying file LICENSE_1_0.txt or
14 copy at http://www.boost.org/LICENSE_1_0.txt)
18 #ifndef BOOST_NUMERIC_ODEINT_UTIL_IS_RESIZEABLE_HPP_INCLUDED
19 #define BOOST_NUMERIC_ODEINT_UTIL_IS_RESIZEABLE_HPP_INCLUDED
24 #include <boost/type_traits/integral_constant.hpp>
25 #include <boost/type_traits/remove_reference.hpp>
26 #include <boost/fusion/include/front.hpp>
27 #include <boost/fusion/include/is_sequence.hpp>
29 #include <boost/mpl/find_if.hpp>
30 #include <boost/mpl/end.hpp>
31 #include <boost/mpl/placeholders.hpp>
32 #include <boost/mpl/if.hpp>
33 #include <boost/type_traits/is_same.hpp>
40 * by default any type is not resizable
42 template< typename Container , typename Enabler = void >
43 struct is_resizeable_sfinae : boost::false_type {};
45 template< typename Container >
46 struct is_resizeable : is_resizeable_sfinae< Container > {};
51 * specialization for std::vector
53 template< class V, class A >
54 struct is_resizeable< std::vector< V , A > > : boost::true_type {};
58 * sfinae specialization for fusion sequences
60 template< typename FusionSequence >
61 struct is_resizeable_sfinae<
63 typename boost::enable_if< typename boost::fusion::traits::is_sequence< FusionSequence >::type >::type >
65 typedef typename boost::mpl::find_if< FusionSequence , is_resizeable< boost::mpl::_1 > >::type iter;
66 typedef typename boost::mpl::end< FusionSequence >::type last;
68 typedef typename boost::mpl::if_< boost::is_same< iter , last > , boost::false_type , boost::true_type >::type type;
69 const static bool value = type::value;
78 } // namespace numeric
83 #endif // BOOST_NUMERIC_ODEINT_UTIL_IS_RESIZEABLE_HPP_INCLUDED