Re: [eigen] Forward declarations

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


Hi Christoph,
On Tue, Jul 19, 2011 at 5:10 PM, Christoph Hertzberg
<chtz@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> 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.

Good point - that hadn't occurred to me.

> 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.

This may be feasible -- I'll add it to my list of ideas :-)

Thanks,
Dave



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