Why not use valarray<valarray<T> > ?

J

Jim West

The GNU implementation of the valarray header (g++ version 3.3.2)
includes the comment:

// This complication is so to make valarray<valarray<T> > work
// even though it is not required by the standard. Nobody should
// be saying valarray<valarray<T> > anyway. See the specs.

Unfortunately, "See the specs" does not give me a whole lot of insight
to why this is a Bad Idea(tm). Can someone please enlighten me?
 
B

Buster

The GNU implementation of the valarray header (g++ version 3.3.2)
includes the comment:

// This complication is so to make valarray<valarray<T> > work
// even though it is not required by the standard. Nobody should
// be saying valarray<valarray<T> > anyway. See the specs.

Unfortunately, "See the specs" does not give me a whole lot of insight
to why this is a Bad Idea(tm). Can someone please enlighten me?

You use slices to make multidimensional arrays with valarray. See the
standard or a good textbook.

Regards,
Buster.
 
J

Jim West

You use slices to make multidimensional arrays with valarray. See the
standard or a good textbook.

Thanks for the response. I do indeed use slices (or Blitz) when using
multidimensional arrays. The nature of the comment made me think that
there might be some non-obvious reason why valarray<valarray<T> > would
give incorrect results, rather than just be inefficient.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top