tags:

views:

21

answers:

1
boost::array<char,7>  buf = {'a','b','c','d','e','f','g'};
...
...
std::cout << buf.data() + 5;

It's display: fg

How to understand it?

buf.data() + 5

Thanks

+1  A: 

buf.data() seems to return a pointer to the internal array buffer in question.

From there, standard pointer arithmetic applies, and you see the 6th character onwards in the std::cout.operator<< call.

Platinum Azure