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

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


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



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