[Dune] [Dune-Commit] dune-grid r7145 - trunk/dune/grid/common

Carsten Gräser graeser at math.fu-berlin.de
Fri Jan 7 11:28:07 CET 2011


Am 07.01.2011 11:12, schrieb Carsten Gräser:
> Hi,
> altough this comment is a little late:
> 
> Was there any discussion on this interface change?
> Even if we agree to forbid the copy constructor
> and assignment they should at least remain public
> for the next release.
Personally I'm not completely sure if we should forbid them:

Having the view-concept in mind one might argue that
intersections are similar to entities and should thus
not be copied.

On the other hand there are use cases where one would
like to store/return Intersections in some way.
While there is an explicit mechanism for Enity (the
EntityPointer) there is no such mechanism for Intersection.
Hence one must store/return IntersectionIterators that are
intended for iterating and nor for storing.

Best,
Carsten



> 
> In case we want to remove them: Is anyone aware of
> a mechanism that generates warnings only if it's
> used in a public context?
> 
> Best,
> Carsten
> 
> 
> Am 27.11.2010 13:56, schrieb mnolte at dune-project.org:
>> Author: mnolte
>> Date: 2010-11-27 13:56:58 +0100 (Sat, 27 Nov 2010)
>> New Revision: 7145
>>
>> Modified:
>>    trunk/dune/grid/common/intersection.hh
>> Log:
>> make copy constructor protected. Intersections, like entities, may not be copied or assigned to
>>
>>
>> Modified: trunk/dune/grid/common/intersection.hh
>> ===================================================================
>> --- trunk/dune/grid/common/intersection.hh	2010-11-27 12:45:59 UTC (rev 7144)
>> +++ trunk/dune/grid/common/intersection.hh	2010-11-27 12:56:58 UTC (rev 7145)
>> @@ -407,10 +407,6 @@
>>    /** Copy Constructor from IntersectionImp */
>>    Intersection(const IntersectionImp<const GridImp> & i) :
>>      real(i) {};
>> -
>> -  /** Copy constructor */
>> -  Intersection(const Intersection& i) :
>> -    real(i.real) {}
>>    //@}
>>  
>>    typedef typename remove_const<GridImp>::type mutableGridImp;
>> @@ -430,6 +426,17 @@
>>    //! return reference to the real implementation 
>>    const ImplementationType & getRealImp() const { return real; }
>>  
>> +  /* hide copy constructor */
>> +  Intersection ( const Intersection &i )
>> +  : real( i.real )
>> +  {}
>> +
>> +  /* hide assignment operator */
>> +  const Intersection &operator= ( const Intersection &i )
>> +  {
>> +    real = i.real;
>> +    return *this;
>> +  }
>>  };




More information about the Dune mailing list