c++ - Iterate over boost::shared_array -


how iterate on items in boost::shared_array? get() on , use raw pointer iterator?

since you're using boost, maybe this:

#include <boost/shared_array.hpp> #include <boost/range.hpp> #include <iostream>  int main() {     boost::shared_array<int> arr(new int[10]());      int* ptr = arr.get();     (int : boost::make_iterator_range(ptr, ptr+10))     {         std::cout << << ',';     } } 

in case, need own bookeeping of array's size.


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -