Re: [eigen] private copy ctors

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


Another argument pro the empty and private implementation is that even in cases where we potentially need the assignment in the future, we will have to implement it anyways manually since VS.net fails to generate the code automatically and probably the resulting compiler errors are nicer too.

Maybe we could make it even nicer with macros. First, it would allow us to prevent this hack for non VC compilers and second, since the we just learned that for state- / memberless objects it is more optimal to let the compiler generate ctor, dtor and assignment (if possible), we could even prevent the explicit implementation for GCC in cases where it were required but GCC manages to create the code automatically.

I could do that... it's just the good old and evil copy 'n paste.

- Hauke

On Sat, Dec 12, 2009 at 11:20 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
OK thanks for the reply and sorry, indeed it is assignment operators
and not copy ctors.

I didn't realize that you only did that in internal classes. Looking
back at it, it's true. Some classes a a bit on the border: for
example, it's not fully clear to me that SelfAdjointView is only
internal and that nobody would want to use its assignment operator.
It's not a big deal however, since there still is the copy ctor.

Benoit

2009/12/12 Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>:
> Of course I ran all unit tests before comitting. The idea is that the
> assignment operators in question are not required - this is emphasized by
> not only making them private but also leaving out the implementation. Those
> small objects are internal only (no outside user should ever be required to
> work with them) and are never copied. They are just proxies or something
> like spring-boards to the real implementations ...
>
> So, to be clear. It were many changes and I hope I did not by accident add
> any private assignment operator to public (for the outside world) classes,
> nor do I hope that I made copy constructors private (though even those are




> probably not required).
>
> - Hauke
>
> p.s. I just double checked - its only assignment operators.
>
> On Sat, Dec 12, 2009 at 6:47 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
> wrote:
>>
>> Hi,
>>
>> this is about Hauke's changeset c2937e22f0aa.
>> https://bitbucket.org/eigen/eigen/changeset/c2937e22f0aa/
>>
>> It adds private copy ctors a bit everywhere.
>>
>> I would be interested in some rationalization for that:
>>  - what warnings does it fix? (what were these warnings saying)
>>  - why is it OK to have the copy ctors private? Doesnt it prevent one
>> from making copies?
>>
>> I'm probably missing something obvious!!
>>
>> Benoit
>>
>>
>
>





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