aimstil  5.0.5
std_wrap.h
Go to the documentation of this file.
1 #ifndef STD_WRAP_H_
2 #define STD_WRAP_H_
3 
5 // I think it is important to pass objects rather than iterators to these functions.
6 // I mean, from what I understand, the reasons why STL is passing iterators around is for technical
7 // reasons (and I mean technical ease, here) -- one of them being compatibility with C-style
8 // arrays, others being I think const and reference type attribute headache.
9 
10 // Okay, actually it's more suble: the iterator can contain part of the algorithm itself,
11 // e.g. reverse or insert or whatever. Such iterators actually extends the power of the
12 // algorithm to degrees the algorithm is not even aware of. That could be taken care of
13 // here by using extra template arguments reflecting the iterator types to use in the algo.
14 
15 // The pb is that iterators generally know almost nothing about the objects they are pointing to.
16 // STL iterators are quite plain and thus manipulating iterators is okay. But when we try to do
17 // more complicated stuff, like compressed arrays, this hurts.
18 // I'm perfectly aware that precisely, compressed arrays and stuff should rather not be STL compliant,
19 // because if they were, it would be too easy to misuse them.
20 // Still: if we want to have a function that is generic and would accept both, we need these functions.
21 
22 namespace til
23 {
25  template < typename TContainer >
26  inline void fill(TContainer & c, typename boost::call_traits<typename TContainer::value_type>::param_type value)
27  {
28  std::fill(c.begin(), c.end(), value);
29  }
30 }
31 
32 #endif /*STD_WRAP_H_*/
Belongs to package Box Do not include directly, include til/Box.h instead.
Definition: Accumulator.h:10
void fill(sparse_vector< T, BaselinePolicy > &v, typename boost::call_traits< T >::param_type value)
Specialized fill for sparse_vector.
void fill(TContainer &c, typename boost::call_traits< typename TContainer::value_type >::param_type value)
Wrapper of std::fill.
Definition: std_wrap.h:47