2
0
mirror of https://github.com/boostorg/odeint.git synced 2026-02-19 02:32:08 +00:00

adding two level specialization for is_resizeable

This commit is contained in:
Karsten Ahnert
2014-05-13 18:06:53 +02:00
committed by alankelly
parent d575761ead
commit 329dabcffc
2 changed files with 55 additions and 18 deletions

View File

@@ -36,35 +36,44 @@
namespace boost {
namespace numeric {
namespace odeint {
template< typename Container , typename Enabler = void >
struct is_resizeable_sfinae : boost::false_type {};
/*
* by default any type is not resizable
*/
template< class Container , class Enabler = void >
struct is_resizeable
{
//struct type : public boost::false_type { };
typedef boost::false_type type;
const static bool value = type::value;
};
template< typename Container >
struct is_resizeable : is_resizeable_sfinae< Container > {};
// /*
// * by default any type is not resizable
// */
// template< class Container , class Enabler = void >
// struct is_resizeable
// {
// //struct type : public boost::false_type { };
// typedef boost::false_type type;
// const static bool value = type::value;
// };
/*
* specialization for std::vector
*/
template< class V, class A >
struct is_resizeable< std::vector< V , A > >
{
//struct type : public boost::true_type { };
typedef boost::true_type type;
const static bool value = type::value;
};
struct is_resizeable< std::vector< V , A > > : boost::true_type {};
// {
// //struct type : public boost::true_type { };
// typedef boost::true_type type;
// const static bool value = type::value;
// };
/*
* specialization for fusion sequences
*/
template< class FusionSequence >
struct is_resizeable< FusionSequence , typename boost::enable_if< typename boost::fusion::traits::is_sequence< FusionSequence >::type >::type >
template< typename FusionSequence >
struct is_resizeable_sfinae<
FusionSequence ,
typename boost::enable_if< typename boost::fusion::traits::is_sequence< FusionSequence >::type >::type >
{
typedef typename boost::mpl::find_if< FusionSequence , is_resizeable< boost::mpl::_1 > >::type iter;
typedef typename boost::mpl::end< FusionSequence >::type last;