I am still working on it. I am writing a new Clone.
Jaco

PS: look like this

  /**
     Performs without unnecessary duplicates "parameter -> member data"
     - const A & -> A             // immediate duplication
     - const A & -> CowPtr<A>     // immediate duplication
     - CowPtr<A> -> A             // immediate duplication
     - CowPtr<A> -> CowPtr<A>     // lazy duplication
     - CountedPtr<A> -> A         // immediate duplication
     - CountedPtr<A> -> CowPtr<A> // lazy duplication

     It uses a pair (const void*,enum), which does not use dynamic
     allocation.

     @note (Speed) Even on a small type (here a pair<int,int>), it is
     much faster than NClone and has the advantage (wrt Clone<T>) to
     handle nicely both const T& and CowPtr<T> as input. It may be
     slightly slower than Clone (and by value or by const ref
     parameter passing) for small objects like a pair<int,int>. This
     is certainly due to the fact that it uses one more integer
     register for \a myParam data member.

     +--------+----------+----------+-----------+--------+--------+
     | Type   | Context  | value    | const ref | Clone  | PClone |
     +--------+----------+----------+-----------+--------+--------+
     | 2xint  |i7 2.4GHz |    48ms |     48ms  |   48ms |   59ms |
     |2xdouble|i7 2.4GHz |    48ms |     48ms  |   48ms |   49ms |
     | 2xint  |Xeon 2.67GHz|    54ms |     54ms  |   54ms |   54ms |
     |2xdouble|Xeon 2.67GHz|    54ms |     54ms  |   54ms | 53.5ms |
     +--------+----------+----------+-----------+--------+--------+


     @note It prevents direct assignment to CountedPtr<T> since their
     meaning is "shared_ptr". A discussion is possible for input pointer: is
     there pointer acquisition in this case ?
  */
  template <typename T>
  class PClone
  {
    enum Parameter { CONST_LEFT_VALUE_REF, COW_PTR, COUNTED_PTR,
CLONE_IS_ERROR }; // ACQ, RREF
  public:
    inline ~PClone() {}
    inline PClone( const PClone & ) : myParam( CLONE_IS_ERROR ), myPtr(
0 ) { ASSERT( false ); }
    inline PClone( const T & t )
      : myParam( CONST_LEFT_VALUE_REF ), myPtr( static_cast<const
void*>( &t ) ) {}
    inline PClone( const CowPtr<T> & t )
      : myParam( COW_PTR ), myPtr( static_cast<const void*>( &t ) ) {}
    inline PClone( const CountedPtr<T> & t )
      : myParam( COUNTED_PTR ), myPtr( static_cast<const void*>( &t ) ) {}

    inline operator T() const
    {
      switch( myParam ) {
      case CONST_LEFT_VALUE_REF: return T( * static_cast< const T* >(
myPtr ) );
      case COW_PTR:   return T( * static_cast< const CowPtr<T>* >( myPtr
)->get() );
      case COUNTED_PTR:   return T( * static_cast< const CountedPtr<T>*
>( myPtr )->get() );
      default: ASSERT( false );
        return T( * static_cast< const T* >( myPtr ) );
      }
    }
    inline operator CowPtr<T>() const
    {
      switch( myParam ) {
      case CONST_LEFT_VALUE_REF: return CowPtr<T>( new T( * static_cast<
const T* >( myPtr ) ) );
      case COW_PTR:   return CowPtr<T>( * static_cast< const CowPtr<T>*
>( myPtr ) );
      case COUNTED_PTR:   return CowPtr<T>( * static_cast< const
CountedPtr<T>* >( myPtr ) );
      default: ASSERT( false );
        return CowPtr<T>( new T( * static_cast< const T* >( myPtr ) ) );
      }
    }

  private:
    const Parameter myParam;
    const void* const myPtr;
  };



Le 04/11/2013 10:08, David Coeurjolly a écrit :
> In src/DGtal/topology/DigitalTopologyTraits.h:
> 
>> +     
>> +     @tparam TForegroundAdjacency any model of CAdjacency.
>> +     @tparam TBackgroundAdjacency any model of CAdjacency.
>> +     @tparam dim the dimension of the embedding digital space.
>> +     
>> +     The traits are specialized for the classical (4,8) and (8,4)
>> +     adjacencies in 2D and (6,18), (6,26), (26,6) and (18,6)
>> +     adjacencies in 3D, following the works of Bertrand and
>> +     Couprie. They specify for GEODESIC_NEIGHBORHOOD_SIZE:
>> +     
>> +     - 2 for (4,8) and (8,4) -> ok
>> +     - 2 for (6,26) -> changed to 1
>> +     - 3 for (6,18) -> changed to 2
>> +     - 2 for (18,6) -> changed to 3
>> +     - 1 for (26,6) -> changed to 2
>> +   */
> 
> are you doing it or you want me to do it?
> 
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/DGtal-team/DGtal/pull/715/files#r7395553>.
>