Re: [eigen] Can we prevent that this compiles?

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


Here, this patch is working. When Gael and/or Benoit agree, I could submit it. Though the error message on VC is not very nice...

Hauke

---------- error message - begin ----------
Error    1    error C2664: 'Eigen::Replicate<MatrixType,RowFactor,ColFactor>::Replicate(const Eigen::Replicate<MatrixType,RowFactor,ColFactor>::MustBeInstantiatedWith<MatrixType> &)' : cannot convert parameter 1 from 'Eigen::Block<MatrixType,BlockRows,BlockCols>' to 'const Eigen::Replicate<MatrixType,RowFactor,ColFactor>::MustBeInstantiatedWith<MatrixType> &'    main.cpp    9
---------- error message - end ----------


On Wed, Sep 30, 2009 at 5:18 PM, Markus Moll <markus.moll@xxxxxxxxxxxxxxxx> wrote:
Hi

On Wednesday 30 September 2009 17:05:28 Hauke Heibel wrote:
> With static asserts we can make the compile error self explanatory. I
> preferred the ctor approach since it does not require implementing a
> ConstRef class.

Hm, but that can be a _very_ thin wrapper even declared inside Replicate
(basically the code I gave is sufficient). It doesn't need to be a full-blown
ConstRef class with all its problems. The more I think about it, the less I
like the template solution. Even with static asserts, the error message will
look radically different from what a user might expect. And the type ConstRef
could be named "MustBeInstantiatedFrom" or "ExactType", so that the candidate
list would read:

candidates are:
 Replicate::Replicate(ExactType<const T&>)
 Replicate::Replicate(const Replicate&);
 [... whatever else ...]

Markus

--
PGP key on www.esat.kuleuven.be/~mmoll/public_key.pgp
Fingerprint is
90C4 B47D 1A00 5AC1 9147  3197 EDA7 1E0E 99E4 9EDB



Attachment: replicate.patch
Description: Binary data



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