Boost logo

Boost :

Subject: Re: [boost] [range] strings
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2010-03-08 13:01:49

Domagoj Saric wrote:

> But in the mentioned case it is not IMO apriori obvious we are dealing with
> arrays...

Well, the type of the variable in question was an array. If you don't
know the types of your variables, you're going to have trouble
understanding what overload get selected by generic libraries.

> Consider a use case like this:
> bool is_a_recognized_string( char const * const string_to_test )
> {
> boost::iterator_range<char const *> const test_string( boost::as_literal(
> string_to_test );

Now it's a pointer to a const char, a vastly different thing.
Does that code even compile? I would have expected as_literal to not
work then.

> For example this does not work in Dinkumware STL implementations:
> std::vector<unsigned char> storage;
> boost::iterator_range<unsigned char const *> storage_chunk( storage );

It's not supposed to work; if you do that, your code is broken.

Boost list run by bdawes at, gregod at, cpdaniel at, john at