|
Boost : |
Subject: Re: [boost] [range][iterator] contiguous iterators
From: Stefan Strasser (strasser_at_[hidden])
Date: 2013-03-19 07:01:35
Am 19.03.2013 01:08, schrieb Kyle Lutz:>> is_contiguous<T *>::value == true
>> is_contiguous<vector<T>::iterator>::value == true
>> is_contiguous<std::list<T>::iterator>::value == false
> I needed this functionality for Boost.Compute in order to determine if
> a region of memory could be copied directly to the GPU or if an
> intermediate std::vector was required. It works just like your example
> except I used the name is_contiguous_iterator instead.
>
> The implementation is here:
https://github.com/kylelutz/compute/blob/master/include/boost/compute/detail/is_contiguous_iterator.hpp
Good, then we just have to collaborate to get it into a public
namespace. Is enable_if there to not require #include <vector>? Could
you add one for boost::container::vector?
Am 19.03.2013 11:29, schrieb Thorsten Ottosen:
>> I'd also like to suggest another addition to Boost.Range:
>> a RangeOutputIterator, i.e. an OutputIterator that doesn't only accept
>> single values, but assignment of ranges:
>>
>> template<class RangeOutputIterator> ... (...RangeOutputIterator out){
>> *out=range;
> Have you considered
> http://www.boost.org/doc/libs/1_53_0/libs/range/doc/html/range/reference/algorithms/new.html
>
> boost::push_back( my_container, my_range )
>
> should be optimally efficient and more direct than using an output range.
No, and thanks, but "more direct" is "too direct" in this case. The
algorithm should remain generic and not only be able to output into
containers.
going back to my example of database.get, you might wanna use it to load
image data into a large container, or use it to load 4 byte into an integer.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk