]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/numeric/odeint/include/boost/numeric/odeint/util/resize.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / numeric / odeint / include / boost / numeric / odeint / util / resize.hpp
CommitLineData
7c673cae
FG
1/*
2 [auto_generated]
3 boost/numeric/odeint/util/state_wrapper.hpp
4
5 [begin_description]
6 State wrapper for the state type in all stepper. The state wrappers are responsible for construction,
7 destruction, copying construction, assignment and resizing.
8 [end_description]
9
10 Copyright 2011-2013 Karsten Ahnert
11 Copyright 2011 Mario Mulansky
12
13 Distributed under the Boost Software License, Version 1.0.
14 (See accompanying file LICENSE_1_0.txt or
15 copy at http://www.boost.org/LICENSE_1_0.txt)
16 */
17
18
19#ifndef BOOST_NUMERIC_ODEINT_UTIL_RESIZE_HPP_INCLUDED
20#define BOOST_NUMERIC_ODEINT_UTIL_RESIZE_HPP_INCLUDED
21
22#include <boost/range.hpp>
23
24#include <boost/utility/enable_if.hpp>
25#include <boost/fusion/include/is_sequence.hpp>
26#include <boost/fusion/include/zip_view.hpp>
27#include <boost/fusion/include/vector.hpp>
28#include <boost/fusion/include/make_fused.hpp>
29#include <boost/fusion/include/for_each.hpp>
30
31#include <boost/numeric/odeint/util/is_resizeable.hpp>
32
33namespace boost {
34namespace numeric {
35namespace odeint {
36
37
38template< class StateOut , class StateIn , class Enabler = void >
39struct resize_impl_sfinae
40{
41 static void resize( StateOut &x1 , const StateIn &x2 )
42 {
43 x1.resize( boost::size( x2 ) );
44 }
45};
46
47// resize function
48// standard implementation relies on boost.range and resize member function
49template< class StateOut , class StateIn >
50struct resize_impl
51{
52 static void resize( StateOut &x1 , const StateIn &x2 )
53 {
54 resize_impl_sfinae< StateOut , StateIn >::resize( x1 , x2 );
55 }
56};
57
58
59// do not overload or specialize this function, specialize resize_impl<> instead
60template< class StateOut , class StateIn >
61void resize( StateOut &x1 , const StateIn &x2 )
62{
63 resize_impl< StateOut , StateIn >::resize( x1 , x2 );
64}
65
66
67namespace detail {
68
69 struct resizer
70 {
71 typedef void result_type;
72
73 template< class StateOut , class StateIn >
74 void operator()( StateOut &x1 , const StateIn &x2 ) const
75 {
76 resize_op( x1 , x2 , typename is_resizeable< StateOut >::type() );
77 }
78
79 template< class StateOut , class StateIn >
80 void resize_op( StateOut &x1 , const StateIn &x2 , boost::true_type ) const
81 {
82 resize( x1 , x2 );
83 }
84
85 template< class StateOut , class StateIn >
86 void resize_op( StateOut &/*x1*/ , const StateIn &/*x2*/ , boost::false_type ) const
87 {
88 }
89
90 };
91} // namespace detail
92
93
94/*
95 * specialization for fusion sequences
96 */
97template< class FusionSeq >
98struct resize_impl_sfinae< FusionSeq , FusionSeq ,
99 typename boost::enable_if< typename boost::fusion::traits::is_sequence< FusionSeq >::type >::type >
100{
101 static void resize( FusionSeq &x1 , const FusionSeq &x2 )
102 {
103 typedef boost::fusion::vector< FusionSeq& , const FusionSeq& > Sequences;
104 Sequences sequences( x1 , x2 );
105 boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( detail::resizer() ) );
106 }
107};
108
109
110
111
112}
113}
114}
115
116
117
118#endif // BOOST_NUMERIC_ODEINT_UTIL_RESIZE_HPP_INCLUDED