Ticket #4919: boost-gil-self-assignment-fix.patch

File boost-gil-self-assignment-fix.patch, 2.3 KB (added by Dean Michael Berris, 5 years ago)

Updated documentation and self-assignments.

  • boost/gil/gil_concept.hpp

     
    254254    // accessor/modifier of the value of each axis.
    255255    template <size_t K> const typename axis<K>::type& T::axis_value() const;
    256256    template <size_t K>       typename axis<K>::type& T::axis_value();
     257
     258    // subscript operator support for getting an lvalue reference to the appropriate axis
     259    value_type& T::operator[](size_t) const;
     260    value_type& T::operator[](size_t);
    257261};
    258262\endcode
    259263*/
     
    272276        LT lt=axis_value<N-1>(point);
    273277        axis_value<N-1>(point)=lt;
    274278   
    275         value_type v=point[0];  ignore_unused_variable_warning(v);
    276         point[0]=point[0];
     279        value_type v=point[0];
     280        point[0]=v;
     281        const P& p=point;
     282        p[0]=v;
    277283    }
    278284    P point;
    279285};
     
    456462    template <typename T>
    457463    struct ChannelIsMutableConcept {
    458464        void constraints() {
    459             c=c;
     465            c1=c2;
    460466            using std::swap;
    461             swap(c,c);
     467            swap(c1,c2);
    462468        }
    463         T c;
     469        T c1;
     470        T c2;
    464471    };
    465472}
    466473
     
    951958    void constraints() {
    952959        gil_function_requires<HomogeneousPixelConcept<P> >();
    953960        gil_function_requires<MutableHomogeneousColorBaseConcept<P> >();
    954         p[0]=p[0];
     961        p[0]=v;
    955962    }
    956963    P p;
     964    typename P::template element_type<P>::type v;
    957965};
    958966
    959967/// \brief Pixel concept that is a Regular type
  • libs/gil/test/pixel_iterator.cpp

     
    147147    unsigned char v8 = get_color( p8, gray_color_t() );
    148148
    149149        // all values should be 110b ( 6 );
    150     //assert( v1 == 6 );
    151     //assert( v2 == 6 );
    152     //assert( v3 == 6 );
    153     //assert( v4 == 6 );
    154     //assert( v5 == 6 );
    155     //assert( v6 == 6 );
    156     //assert( v7 == 6 );
    157     //assert( v8 == 6 );
     150    assert( v1 == 6 );
     151    assert( v2 == 6 );
     152    assert( v3 == 6 );
     153    assert( v4 == 6 );
     154    assert( v5 == 6 );
     155    assert( v6 == 6 );
     156    assert( v7 == 6 );
     157    assert( v8 == 6 );
    158158}
    159159
    160160// TODO: Make better tests. Use some code from below.