Re: [eigen] Forward declarations

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


On 19.07.2011 17:27, David Lonie wrote:
When I try that, AutoAlign, RowMajor, ColMajor, and
EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION are all undefined. I could
swap out the integer values for the constants and have a fragile
solution, but AIUI EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION is
build-specific and cannot be known without including Eigen. Should I
assume that the class cannot be forward declared and start looking at
my other options, or is there a trick to get around this?

I have not looked deeply into your library, but I am afraid that forward-declaration is doomed to fail as soon as someone actually includes the Eigen headers. IIRC forward-declaration for templated classes is not allowed to set the default parameters a second time.

What might work is to make a self-containing forward-declaration header for Eigen (similar to C++ standards <iosfwd>) which is also included by Eigen itself. This could be copied by libraries using it, however there would be no downwards compatibility then ...

Also, what you could do on side of your library, is to inherit from Eigen classes and just forward-declare the inheriting classes. However, this comes at the cost of needing to reimplement the constructors.


Christoph


--
----------------------------------------------
Dipl.-Inf. Christoph Hertzberg
Cartesium 0.051
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: (+49) 421-218-64252
----------------------------------------------



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