rheolef  6.5
array_store.h
Go to the documentation of this file.
1 #ifndef _RHEOLEF_ARRAY_STORE_H
2 #define _RHEOLEF_ARRAY_STORE_H
3 namespace rheolef {
4 template <class OutputRandomIterator, class SetOp, class Size, class IsContainer = boost::mpl::false_>
5 struct array_store {};
6 
7 template <class OutputRandomIterator, class SetOp, class Size>
8 struct array_store<OutputRandomIterator, SetOp, Size, boost::mpl::false_> {
9  typedef typename std::iterator_traits<OutputRandomIterator>::value_type T;
10  typedef typename std::pair<Size,T> data_type;
11  void operator()(const std::pair<Size,T>& val) { _op(_x [val.first], val.second); }
12  Size n_new_entry() const { return 0; }
13  array_store(OutputRandomIterator x, SetOp op) : _x(x), _op(op) {}
14  OutputRandomIterator _x;
15  SetOp _op;
16 };
17 template <class OutputRandomIterator, class SetOp, class Size>
18 struct array_store<OutputRandomIterator, SetOp, Size, boost::mpl::true_> {
19  typedef typename std::iterator_traits<OutputRandomIterator>::value_type T;
20  typedef typename T::value_type U;
21  typedef typename std::pair<Size,U> data_type;
22  void operator()(const std::pair<Size,U>& val) {
23 #ifdef TO_CLEAN
24  _x [val.first].insert (val.second);
25 #endif // TO_CLEAN
26  _op (_x [val.first], val.second);
27  }
28  Size n_new_entry() const { return 0; }
29  array_store(OutputRandomIterator x, SetOp op) : _x(x), _op(op) {}
30  OutputRandomIterator _x;
31  SetOp _op;
32 };
33 
34 template <class OutputRandomIterator, class SetOp, class Size, class IsContainer>
35 inline
37 array_make_store(OutputRandomIterator x, SetOp op, Size, IsContainer)
38 {
40 }
41 } // namespace rheolef
42 #endif // _RHEOLEF_ARRAY_STORE_H
43