Boost logo

Boost :

Subject: Re: [boost] [util] Any interest in address_of_first_nonarray_elem ?
From: Piotr Wygocki (vwygos_at_[hidden])
Date: 2013-12-02 09:13:26


Hi,

1) are you aware of boost::multi_array?

   http://www.boost.org/doc/libs/1_55_0/libs/multi_array/doc/index.html

  I don't now this library well but seems that multi_array gives you
correct == operator.

2) flat_begin/flat_end name is more intuitive for me.

Regards,

Piotr

On 2 December 2013 11:34, Joaquin M Lopez Munoz <joaquin_at_[hidden]> wrote:

> Mostafa <mostafa_working_away <at> yahoo.com> writes:
>
> >
> > On Sun, 01 Dec 2013 23:56:41 -0800, Joaquin M Lopez Munoz <joaquin <at>
> tid.es>
> > wrote:
> > >
> > > Why the "non"? Shouldn't the name be "address_of_first_array_elem"?
> > > How is this different from std::begin(lhs)?
> >
> > No. The motivating use case for this were built-in multidimensional
> > arrays. I wanted a generic way to compare and copy them without resorting
> > to nested loops.
> >
> > For example:
> >
> > typedef int ArrType[2][3];
> >
> > ArrType a1 = { {0, 1, 2}, {3, 4, 5} };
> > ArrType a2 = { {0, 1, 2}, {3, 4, 5} };
> >
> > // Prints 0.
> > std::cout << "Std Equal: " << std::equal(a1, a1 + 2, a2) << "\n";
> > // Prints 1. Obviously address_of_first_nonarray_elem would be used
> > instead of subscripting.
> > std::cout
> > << "Flattened Std Equal: " << std::equal(a1[0], a1[0] + 6, a2[0])
>
> Ok, I got it now. The name is not very illuminating, maybe
> flat_begin/flat_end or a flat_view with begin/end/size would do better.
>
> Joaquín M López Muñoz
> Telefónica Digital
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk