|
Boost : |
From: Randy Roberts (rroberts_at_[hidden])
Date: 2000-12-07 16:04:51
--- In boost_at_[hidden], Daryle Walker <darylew_at_m...> wrote:
> on 12/5/00 9:53 AM, Gavin Collings at gcollings_at_s... wrote:
>
> [SNIP]
> > All of those alls seem to hint at a commonality; better it would
be
> > to support the all element interface through a view: -
> >
> >
> > class flattened_array
> > {
> > public:
> >
> > flattened_array( array * );
[SNIP]
> > // insert clean container interface here.
> >
> > private:
> >
> > array * array_;
> > };
> >
> > class array
> > {
> > // ...
> >
> > flattened_array flat() { return flattened_array( this ); }
> > };
>
> Should flattened_array be a friend of array? If not, then
flattened_array
> has to work by translating array indices. If it does use indices,
then we
> could offer a FORTRAN-order version along with the normal (C-order)
version.
> FORTRAN-order puts the fastest index first instead of last.
Some of us do alot of interfacing with old F77 or newer F90 code.
An **intrinsic** FORTRAN-order for the actual array class would
probably
be more efficient, especially since we would need a raw pointer to the
data in contiguous FORTRAN-order. Therefore, I propose that the array
class be templated on a policy parameter dictating the intrinsic
ordering
of the data.
template <int N>
class C_ordering_policy
{
// I'll have to think about what goes in here. Sorry!
};
template <int N>
class F77_ordering_policy
{
// I'll have to think about what goes in here. Sorry!
};
template <typename T, int N, class OrderingPolicy=C_ordering_policy<N>
>
class array : private OrderingPolicy
{
// Use the OrderingPolicy to correctly create sub_array<N-1>
};
Sorry it's so sketchy, but my attempt at N-dimensional arrays was
similar
to the original article, but used std::valarray for the
representation.
The different OrderingPolicy's created and manipulated std::gslice's
that were contained within the array's representation. I don't think
we want to do this here. :-}
Regards,
Randy
-- Randy M. Roberts | "His men would follow him anywhere, rroberts_at_[hidden] | but only out of morbid curiosity." rsqrd_at_[hidden] | -- a performance review work: (505)665-4285
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk