|
Boost : |
From: Stjepan Rajko (stipe_at_[hidden])
Date: 2007-06-04 12:34:35
On 6/4/07, Michael Tegtmeyer <tegtmeye_at_[hidden]> wrote:
> Stjepan,
> 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
> the convenience.
>
I see. Sorry, I'm ignorant of such issues, I had to look up what
strict aliasing rules are :-) I'm not sure whether the following
might be a compromise:
namespace n_std
{
namespace no_alias
{
... current cvalarray
}
namespace alias
{
... cvalarray that inherits array
}
using namespace alias;
}
Or, there could be two classes, one called cvalarray and the other
called value_array.
I'll try tweaking your code to allow for the former option just
because it will be easy to throw together from your code (although I
think the latter option seems cleaner and still explains what's going
on).
Regards,
Stjepan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk