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

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -