[eigen] std::vector specialization

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi there,

I just want to bring this up once more - sorry. Last year, we decided
to force users to explicitly pass Eigen::aligned_allocator to STL
containers storing Eigen types. All good and it seems to be working
for everybody.

Now, I would like to offer an alternative. It is 100% compatible with
the previous policy. I propose once again to offer a convenience macro
that allows to do

  EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION_TPL(Vector4d)

and then in turn to use

  std::vector<Vector4d> my_vec;

I see the following advantages:

- less typing (yes, we are lazy)
- easier switching between different libraries (hopefully, nobody will
ever do this)
- allows to use std::allocator on systems with automatic alignment
(e.g. VC9 x64)
- in the end it is still optional...

and to be fair, these are the disadvantages I see right away:

- error prone in the sense that the define has to exist before using std::vector
- are variadic macros supported by all compilers? probably just a
minor drawback.

I don't see anything else for the moment. The patch attached to this
mail has been tested with VC9, ICC and GCC 4.4.1.

So, what are you thinking about this?

- Hauke

Attachment: vector_spec.patch
Description: Binary data



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/