Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2006-06-24 07:34:43

Gennaro Prota wrote:
> <>
> should be closed.


> * in the mentioned specialization (I haven't checked the primary
> template, maybe there too), there are many repetitions of:
> failed_rangecheck();
> return null_item();
> Anywhere this is used the return type is either reference or
> const_reference, so one could replace all of those occurrences with:
> return failed_function();
> where failed_function() is defined as
> static reference failed_function()
> {
> failed_rangecheck();
> return null_item();
> }

Yep that can be simplied quite a bit, done in cvs. I haven't added the
static_cast's: it obfuscates the code and serves no real purpose - no value
can actually ever be returned.

> NOTE: Going a bit further null_item() is not necessary, as one could
> use a return *(new T) directly in failed_range_check(), though I
> haven't thought of all the consequences in the case operator new is
> overloaded.

Not so sure about that.

> * why are the two operator[]() functions range-checked for the case
> N==0? And what's the point of those BOOST_ASSERT( "out of range" )?

No idea - Alistair?

I've removed them for now since they serve no purpose that I can see:
they'll always pass won't they?


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