Opened 12 years ago

Closed 12 years ago

#4280 closed Feature Requests (duplicate)

Cannot get array type from boost::array

Reported by: anonymous Owned by: Marshall Clow
Milestone: Boost 1.43.0 Component: array
Version: Boost 1.44.0 Severity: Optimization
Keywords: Cc:

Description

There is no function to get array from the boost::array. c_array returns pointer, and operator[] returns reference.

There must be additional function, as_array.

array<T, N> {

typedef T array_type[N];

array_type& as_array() { return elems; } array_type const& as_array() const { return elems; }

}

It is needed to allow optimizations when function has special overload for arrays. Like std::copy in VC compiler:

  1. copy(Input first, Input last, Output dest)
  2. copy(Input first, Input last, OutElem (&dest)[size])

Change History (5)

comment:1 by anonymous, 12 years ago

Sorry for missing code formatting.

array<T, N>
{
    typedef T array_type[N];

    array_type&       as_array()       { return elems; }
    array_type const& as_array() const { return elems; }
}
 

comment:2 by NN, 12 years ago

Type: BugsFeature Requests

There is a solution to use elems public member. It is nicer to have a method for this.

comment:3 by Marshall Clow, 12 years ago

Owner: changed from No-Maintainer to Marshall Clow

How does this differ from ticket #2857 ?

comment:4 by Marshall Clow, 12 years ago

Closing as a duplicate of #2857

comment:5 by Marshall Clow, 12 years ago

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.