From: Michael Tegtmeyer (tegtmeye_at_[hidden])
Date: 2007-06-04 09:06:23
Thanks, I'll take a look.
As for the storage part, inheriting from boost::array is probably not a
good thing. One of the principal reasons that std::valarray does not
support iterators is that pointers to the actual storage of the array (or
types that pretend that they are) violate the strict aliasing rules that
the standard requires for the class. Since cvalarray is intended to mimic
the purpose and semantics of std::valarray with the exception of being
statically sized, I'm not sure introducing an aliasing violation is worth
>From 26.3.1 Header<valarray> synopsis
>> The valarray array classes are defined to be free of certain forms of
aliasing, thus allowing operations on these classes to be optimized.
>> The intent is to specify an array template that has the minimum
functionality necessary to address aliasing ambiguities and the
proliferation of temporaries.
On Mon, 4 Jun 2007, Stjepan Rajko wrote:
> Hi Michael,
> OK I got to play with the library finally :-) It seems pretty
> complete, nice work! I derived a little class based on your cvalarray
> called cvalarray_constructible which offers the constructors I was
> suggesting (for N<=UNROLL_LIMIT). Source attached, if you're
> interested (it uses your original cvalarray.h except it wants v to be
> protected instead of private). I'm not sure whether in its current
> state it works interchangeably with cvalarray objects, though.
> One other comment - instead of storing the array as a member T v[N],
> maybe you can consider inheriting boost::array<T, N>. This would give
> you iteration support and a few other things, assuming it wouldn't
> cause any problems.
> On 5/30/07, Stjepan Rajko <stipe_at_[hidden]> wrote:
>> On 5/30/07, Michael Tegtmeyer <tegtmeye_at_[hidden]> wrote:
>> > In any case, the decision to stray from std::valarray's interface in this
>> > area was an arbitrary one so it is easy to chose the other option. The
>> > interface now mimics std::valarray for single value as well as pointer
>> > arguments in that they require a size parameter.
>> > The test cases and docs have been updated and the new version
>> > (cvalarray-.1.3.tar.gz) is now in the vault.
>> > I have also included MSVS project files located in the 'tests' directory
>> > that will run all 24 tests. I do not use MSVS much so I don't promise
>> > it is elegant.
>> Thanks very much for doing this! I will try to take a look at the new
>> version tomorrow.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk