Boost logo

Boost Users :

From: Ian Whittley (imw_at_[hidden])
Date: 2005-10-09 13:01:26


hi,

i've implemented an extended form of 'fill' algorithm that can handle
multi-dimensional containers and would appreciate comments on whether:

a) i've reinvented the wheel and such code is already available in boost,
b) i've made some obvious mistake that my (admittedly minimal) testing
hasn't found yet,
c) it would be useful to anybody :)

the code is given below (namespace declarations removed):

template<class Range, class Value>
typename enable_if_c<is_convertible<Value, Range>::value>::type
fill(Range& range, Value const& value)
{
  range = value;
}

template<class Range, class Value>
typename disable_if_c<is_convertible<Value, Range>::value>::type
fill(Range& range, Value const& value)
{
  for(range_iterator<Range>::type i = boost::begin(range); i !=
boost::end(range); ++i)
    fill(*i, value);
}

comments appreciated,

thanks,

ian whittley


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net