|
Boost : |
From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2006-06-18 20:30:54
Hi,
some misc, quick, comments about boost array:
* the current CVS version has the required partial specialization for
the case N==0; I haven't actually compiled it, but I suppose
<http://sourceforge.net/tracker/index.php?func=detail&aid=1484104&group_id=7586&atid=107586>
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();
}
For additional safety, functions returning a const_reference ought to
do:
return static_cast<const_reference>(failed_function());
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.
* 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" )?
--Gennaro.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk