Glas :Re: [glas] unallocated fill |
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2005-10-03 06:36:59
On Monday 03 October 2005 3:19 am, Karl Meerbergen wrote:
> On Friday 30 September 2005 20:22, Neal Becker wrote:
> > Suggest adding to dense_vector.hpp:
> > dense_vector(size_type size, value_type const& init)
> >
> > : size_( size )
> >
> > {
> > begin_ = alloc_.allocate( size ) ;
> > std::uninitialized_fill (begin(), end(), init);
> >
> > }
> > _______________________________________________
> > glas mailing list
> > glas_at_[hidden]
> > http://lists.boost.org/mailman/listinfo.cgi/glas
>
> Hi Neal,
>
> Personally, I prefer a free function fill( v, init ) ;
> Similarly, clear_values() and clear() also are free functions.
> rather than a member function. I agree that some form of initialization is
> quite useful.
>
It is important to separate allocation and initialization for HPC. Here is
what I believe. The default construction should not perform initialization.
It looks to me that glas already follows this. If you want initialization,
use the alternative constructor as I show above.