Ignore:
Timestamp:
Dec 15, 2008, 1:57:43 PM (13 years ago)
Author:
Peter
Message:

fixes #467 - implicit conversion between Vector and its Views are no longer allowed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/VectorView.h

    r1487 r1651  
    110110       is undefined.
    111111    */
    112     VectorView(VectorMutable& other);
     112    explicit VectorView(VectorMutable& other);
    113113
    114114    /**
     
    143143    VectorView(Matrix& m, size_t i, bool row=true);
    144144
    145     /**
    146        \brief create VectorView from proxy class
    147      */
    148     VectorView(proxy p);
    149 
    150145    ///
    151146    /// The destructor.
     
    186181
    187182    gsl_vector_view* view_;
     183
     184    /**
     185       Proxy class used to allow copy and assignment of VectorView. By
     186       design vectors and matrices are passed as non-const references
     187       in all constructors of VectorView. Because the standard does
     188       not allow temporary objects to be bound to non-const
     189       references, it is not possible to directly construct a
     190       VectorView from a temporary VectorView returned from a
     191       function. Instead this proxy class is created from the
     192       temporary object and then a VectorView can be created from this
     193       proxy.
     194     */
     195    struct proxy
     196    {
     197      /// pointer to GSL vector keeping everything we need to create a
     198      /// new VectorMutable from a proxy.
     199      gsl_vector* vec_;
     200    };
     201
     202  public:
     203    /**
     204       \brief create VectorView from proxy class
     205     */
     206    VectorView(proxy p);
     207
     208    /**
     209       conversion operator to private proxy class.
     210     */
     211    operator proxy();
    188212  };
    189213
Note: See TracChangeset for help on using the changeset viewer.