Opened 16 years ago

Closed 16 years ago

#623 closed Bugs (Fixed)

insignificant boost::array bug

Reported by: nobody Owned by: nobody
Milestone: Component: None
Version: None Severity:
Keywords: Cc:

Description

A little thing I noticed when browsing the header
array.hpp :

  static bool empty() { return false; }

What if N is 0? Ok everything else then frequent
however I'd suggest using

  static bool empty() { return N == 0; }

as it is also likly to be evaluated at complietime and
could perhaps avoid some subtil problems in meta
programming. 

Change History (3)

comment:1 by me22, 16 years ago

Logged In: YES 
user_id=509832

Have you tried making a boost::array with N==0?

The language doesn't allow zero-length arrays, so it'll
cause a compiler error.

comment:2 by alisdairm27386, 16 years ago

Logged In: YES 
user_id=1392509

Standard Library TR1 required the array template to 
support arrays of length zero.

A partial specialization will be added to the 1.34 release 
to support this case.  Checking the sequence requirements 
I believe that empty should indeed return true for the 
case N == 0. (even though it is also 'full')

comment:3 by John Maddock, 16 years ago

Status: assignedclosed
Logged In: YES 
user_id=14804

There's a specialisation for the N==0 case now, so this
should be fixed.

Thanks,  John.
Note: See TracTickets for help on using tickets.