On Fri, 8 Aug 2003, Dave Gomboc wrote:
dave> >
dave> > const in array{] = {1, 2, 3, 4};
dave> > boost::array<int> ba(array);
dave> > std::copy(ba.begin(), ba.end(), std_ostream_iterator<int>(std::cout));
dave> >
dave> > Is there already a way to do this?  Or is there some reason why
dave> > one would never want to do this?
dave>
dave> AFAICR boost::array allows initialization.  I would try
dave>
dave> const boost::array<int> ba = {1, 2, 3, 4};
dave> std::copy(ba.begin(), ba.end(), std_ostream_iterator<int>(std::cout));

But he doesn't want coping. There's the simple solution

const int array[] = {1, 2, 3, 4};
std::copy(array, array + 4, ...);

and also there's the array_traits in the sandbox.

However, did he want the exact interface as boost::array? If so, I'd say
we need a new class called ptr_array that adapts a pointer and a size into
an array.

Cheers,
Jeremy


----------------------------------------------------------------------
 Jeremy Siek                          http://php.indiana.edu/~jsiek/
 Ph.D. Student, Indiana Univ. B'ton   email: [EMAIL PROTECTED]
 C++ Booster (http://www.boost.org)   office phone: (812) 855-3608
----------------------------------------------------------------------

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to