Re: [eigen] Forward declarations |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Forward declarations
- From: David Lonie <loniedavid@xxxxxxxxx>
- Date: Wed, 20 Jul 2011 08:58:37 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=BShW2Zmkz9KHdEzge7M6aRPbBNKQqaSFn4f9KaErF9E=; b=oOrGIW4EfL88c4HwcOo0Yr4lvsGoRKRqzIbDA7/W5HHnoDuMDRhuD2eDHgWkEJZiB2 pLXKT61JaI1a3lMn46pwEPgRvEAxG6kHz0BnQHC9zQw8NkAOEbjb6YoXhj6DJN24KIAz XXCwHXOPI/MVOCZvrLOn9YyAxcQMgPRlKBfLg=
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