14 changes: 7 additions & 7 deletions include/boost/gil/extension/dynamic_image/reduce.hpp
Expand Up @@ -147,11 +147,11 @@ struct unary_reduce : public unary_reduce_impl<Types,Op> {
typedef typename mpl::mapping_vector<reduced_t, unique_t> indices_t;
return gil::at_c<indices_t, unsigned short>(index);
}
template <typename Bits> GIL_FORCEINLINE static typename Op::result_type applyc(const Bits& bits, std::size_t index, Op op) {
template <typename Bits> BOOST_FORCEINLINE static typename Op::result_type applyc(const Bits& bits, std::size_t index, Op op) {
return apply_operation_basec<unique_t>(bits,map_index(index),op);
}

template <typename Bits> GIL_FORCEINLINE static typename Op::result_type apply(Bits& bits, std::size_t index, Op op) {
template <typename Bits> BOOST_FORCEINLINE static typename Op::result_type apply(Bits& bits, std::size_t index, Op op) {
return apply_operation_base<unique_t>(bits,map_index(index),op);
}
};
Expand All @@ -161,11 +161,11 @@ struct unary_reduce<Types,Op,true> : public unary_reduce_impl<Types,Op> {
typedef typename unary_reduce_impl<Types,Op>::unique_t unique_t;
static unsigned short inline map_index(std::size_t index) { return 0; }

template <typename Bits> GIL_FORCEINLINE static typename Op::result_type applyc(const Bits& bits, std::size_t index, Op op) {
template <typename Bits> BOOST_FORCEINLINE static typename Op::result_type applyc(const Bits& bits, std::size_t index, Op op) {
return op(*gil_reinterpret_cast_c<const typename mpl::front<unique_t>::type*>(&bits));
}

template <typename Bits> GIL_FORCEINLINE static typename Op::result_type apply(Bits& bits, std::size_t index, Op op) {
template <typename Bits> BOOST_FORCEINLINE static typename Op::result_type apply(Bits& bits, std::size_t index, Op op) {
return op(*gil_reinterpret_cast<typename mpl::front<unique_t>::type*>(&bits));
}
};
Expand Down Expand Up @@ -245,17 +245,17 @@ struct binary_reduce {
};

template <typename Types, typename UnaryOp>
GIL_FORCEINLINE typename UnaryOp::result_type apply_operation(variant<Types>& arg, UnaryOp op) {
BOOST_FORCEINLINE typename UnaryOp::result_type apply_operation(variant<Types>& arg, UnaryOp op) {
return unary_reduce<Types,UnaryOp>::template apply(arg._bits, arg._index ,op);
}

template <typename Types, typename UnaryOp>
GIL_FORCEINLINE typename UnaryOp::result_type apply_operation(const variant<Types>& arg, UnaryOp op) {
BOOST_FORCEINLINE typename UnaryOp::result_type apply_operation(const variant<Types>& arg, UnaryOp op) {
return unary_reduce<Types,UnaryOp>::template applyc(arg._bits, arg._index ,op);
}

template <typename Types1, typename Types2, typename BinaryOp>
GIL_FORCEINLINE typename BinaryOp::result_type apply_operation(const variant<Types1>& arg1, const variant<Types2>& arg2, BinaryOp op) {
BOOST_FORCEINLINE typename BinaryOp::result_type apply_operation(const variant<Types1>& arg1, const variant<Types2>& arg2, BinaryOp op) {
return binary_reduce<Types1,Types2,BinaryOp>::template apply(arg1._bits, arg1._index, arg2._bits, arg2._index, op);
}

Expand Down
6 changes: 3 additions & 3 deletions include/boost/gil/extension/numeric/affine.hpp
Expand Up @@ -49,7 +49,7 @@ class matrix3x2 {
T a,b,c,d,e,f;
};

template <typename T> GIL_FORCEINLINE
template <typename T> BOOST_FORCEINLINE
matrix3x2<T> operator*(const matrix3x2<T>& m1, const matrix3x2<T>& m2) {
return matrix3x2<T>(
m1.a * m2.a + m1.b * m2.c,
Expand All @@ -60,7 +60,7 @@ matrix3x2<T> operator*(const matrix3x2<T>& m1, const matrix3x2<T>& m2) {
m1.e * m2.b + m1.f * m2.d + m2.f );
}

template <typename T, typename F> GIL_FORCEINLINE
template <typename T, typename F> BOOST_FORCEINLINE
point2<F> operator*(const point2<T>& p, const matrix3x2<F>& m) {
return point2<F>(m.a*p.x + m.c*p.y + m.e, m.b*p.x + m.d*p.y + m.f);
}
Expand All @@ -85,7 +85,7 @@ struct mapping_traits<matrix3x2<F> > {
typedef point2<F> result_type;
};

template <typename F, typename F2> GIL_FORCEINLINE
template <typename F, typename F2> BOOST_FORCEINLINE
point2<F> transform(const matrix3x2<F>& mat, const point2<F2>& src) { return src * mat; }

} } // namespace boost::gil
Expand Down
2 changes: 1 addition & 1 deletion include/boost/gil/extension/numeric/algorithm.hpp
Expand Up @@ -83,7 +83,7 @@ struct inner_product_k_t<0> {
template <std::size_t Size,
class _InputIterator1, class _InputIterator2, class _Tp,
class _BinaryOperation1, class _BinaryOperation2>
GIL_FORCEINLINE
BOOST_FORCEINLINE
_Tp inner_product_k(_InputIterator1 __first1,
_InputIterator2 __first2,
_Tp __init,
Expand Down
16 changes: 8 additions & 8 deletions include/boost/gil/extension/numeric/convolve.hpp
Expand Up @@ -144,7 +144,7 @@ struct correlator_k {
/// \ingroup ImageAlgorithms
///correlate a 1D variable-size kernel along the rows of an image
template <typename PixelAccum,typename SrcView,typename Kernel,typename DstView>
GIL_FORCEINLINE
BOOST_FORCEINLINE
void correlate_rows(const SrcView& src, const Kernel& ker, const DstView& dst,
convolve_boundary_option option=convolve_option_extend_zero) {
detail::correlate_rows_imp<PixelAccum>(src,ker,dst,option,detail::correlator_n<PixelAccum>(ker.size()));
Expand All @@ -153,7 +153,7 @@ void correlate_rows(const SrcView& src, const Kernel& ker, const DstView& dst,
/// \ingroup ImageAlgorithms
///correlate a 1D variable-size kernel along the columns of an image
template <typename PixelAccum,typename SrcView,typename Kernel,typename DstView>
GIL_FORCEINLINE
BOOST_FORCEINLINE
void correlate_cols(const SrcView& src, const Kernel& ker, const DstView& dst,
convolve_boundary_option option=convolve_option_extend_zero) {
correlate_rows<PixelAccum>(transposed_view(src),ker,transposed_view(dst),option);
Expand All @@ -162,7 +162,7 @@ void correlate_cols(const SrcView& src, const Kernel& ker, const DstView& dst,
/// \ingroup ImageAlgorithms
///convolve a 1D variable-size kernel along the rows of an image
template <typename PixelAccum,typename SrcView,typename Kernel,typename DstView>
GIL_FORCEINLINE
BOOST_FORCEINLINE
void convolve_rows(const SrcView& src, const Kernel& ker, const DstView& dst,
convolve_boundary_option option=convolve_option_extend_zero) {
correlate_rows<PixelAccum>(src,reverse_kernel(ker),dst,option);
Expand All @@ -171,7 +171,7 @@ void convolve_rows(const SrcView& src, const Kernel& ker, const DstView& dst,
/// \ingroup ImageAlgorithms
///convolve a 1D variable-size kernel along the columns of an image
template <typename PixelAccum,typename SrcView,typename Kernel,typename DstView>
GIL_FORCEINLINE
BOOST_FORCEINLINE
void convolve_cols(const SrcView& src, const Kernel& ker, const DstView& dst,
convolve_boundary_option option=convolve_option_extend_zero) {
convolve_rows<PixelAccum>(transposed_view(src),ker,transposed_view(dst),option);
Expand All @@ -180,7 +180,7 @@ void convolve_cols(const SrcView& src, const Kernel& ker, const DstView& dst,
/// \ingroup ImageAlgorithms
///correlate a 1D fixed-size kernel along the rows of an image
template <typename PixelAccum,typename SrcView,typename Kernel,typename DstView>
GIL_FORCEINLINE
BOOST_FORCEINLINE
void correlate_rows_fixed(const SrcView& src, const Kernel& ker, const DstView& dst,
convolve_boundary_option option=convolve_option_extend_zero) {
detail::correlate_rows_imp<PixelAccum>(src,ker,dst,option,detail::correlator_k<Kernel::static_size,PixelAccum>());
Expand All @@ -189,7 +189,7 @@ void correlate_rows_fixed(const SrcView& src, const Kernel& ker, const DstView&
/// \ingroup ImageAlgorithms
///correlate a 1D fixed-size kernel along the columns of an image
template <typename PixelAccum,typename SrcView,typename Kernel,typename DstView>
GIL_FORCEINLINE
BOOST_FORCEINLINE
void correlate_cols_fixed(const SrcView& src, const Kernel& ker, const DstView& dst,
convolve_boundary_option option=convolve_option_extend_zero) {
correlate_rows_fixed<PixelAccum>(transposed_view(src),ker,transposed_view(dst),option);
Expand All @@ -198,7 +198,7 @@ void correlate_cols_fixed(const SrcView& src, const Kernel& ker, const DstView&
/// \ingroup ImageAlgorithms
///convolve a 1D fixed-size kernel along the rows of an image
template <typename PixelAccum,typename SrcView,typename Kernel,typename DstView>
GIL_FORCEINLINE
BOOST_FORCEINLINE
void convolve_rows_fixed(const SrcView& src, const Kernel& ker, const DstView& dst,
convolve_boundary_option option=convolve_option_extend_zero) {
correlate_rows_fixed<PixelAccum>(src,reverse_kernel(ker),dst,option);
Expand All @@ -207,7 +207,7 @@ void convolve_rows_fixed(const SrcView& src, const Kernel& ker, const DstView& d
/// \ingroup ImageAlgorithms
///convolve a 1D fixed-size kernel along the columns of an image
template <typename PixelAccum,typename SrcView,typename Kernel,typename DstView>
GIL_FORCEINLINE
BOOST_FORCEINLINE
void convolve_cols_fixed(const SrcView& src, const Kernel& ker, const DstView& dst,
convolve_boundary_option option=convolve_option_extend_zero) {
convolve_rows_fixed<PixelAccum>(transposed_view(src),ker,transposed_view(dst),option);
Expand Down
2 changes: 1 addition & 1 deletion include/boost/gil/extension/numeric/resample.hpp
Expand Up @@ -72,7 +72,7 @@ namespace detail {
Sampler _sampler;
resample_pixels_fn(const MapFn& dst_to_src, const Sampler& sampler) : _dst_to_src(dst_to_src), _sampler(sampler) {}

template <typename SrcView, typename DstView> GIL_FORCEINLINE void apply_compatible(const SrcView& src, const DstView& dst) const {
template <typename SrcView, typename DstView> BOOST_FORCEINLINE void apply_compatible(const SrcView& src, const DstView& dst) const {
resample_pixels(src, dst, _dst_to_src, _sampler);
}
};
Expand Down
2 changes: 1 addition & 1 deletion include/boost/gil/extension/toolbox/color_spaces/lab.hpp
Expand Up @@ -84,7 +84,7 @@ struct default_color_converter_impl< xyz_t, lab_t >
{
private:
/// \ref http://www.brucelindbloom.com/index.html?Eqn_XYZ_to_Lab.html
GIL_FORCEINLINE
BOOST_FORCEINLINE
bits32f forward_companding(bits32f value) const
{
if (value > 216.f/24389.f)
Expand Down
4 changes: 2 additions & 2 deletions include/boost/gil/extension/toolbox/color_spaces/xyz.hpp
Expand Up @@ -55,7 +55,7 @@ template <>
struct default_color_converter_impl< rgb_t, xyz_t >
{
private:
GIL_FORCEINLINE
BOOST_FORCEINLINE
bits32f inverse_companding(bits32f sample) const
{
if ( sample > 0.04045f )
Expand Down Expand Up @@ -111,7 +111,7 @@ template <>
struct default_color_converter_impl<xyz_t,rgb_t>
{
private:
GIL_FORCEINLINE
BOOST_FORCEINLINE
bits32f companding(bits32f sample) const
{
if ( sample > 0.0031308f )
Expand Down
169 changes: 133 additions & 36 deletions include/boost/gil/extension/toolbox/image_types/subsampled_image.hpp
Expand Up @@ -34,7 +34,7 @@ typedef boost::gil::point2< std::ptrdiff_t > point_t;
template< typename Locator >
struct subsampled_image_deref_fn
{
typedef Locator plane_locator_t;
typedef gray8_view_t::locator plane_locator_t;

typedef subsampled_image_deref_fn const_t;
typedef typename Locator::value_type value_type;
Expand All @@ -49,33 +49,56 @@ struct subsampled_image_deref_fn
subsampled_image_deref_fn() {}

/// constructor
subsampled_image_deref_fn( const Locator& y_locator
, const Locator& v_locator
, const Locator& u_locator
subsampled_image_deref_fn( const plane_locator_t& y_locator
, const plane_locator_t& v_locator
, const plane_locator_t& u_locator
, const std::size_t ux_ssfactor
, const std::size_t uy_ssfactor
, const std::size_t vx_ssfactor
, const std::size_t vy_ssfactor
)
: _y_locator( y_locator )
, _v_locator( v_locator )
, _u_locator( u_locator )
: _y_locator ( y_locator )
, _v_locator ( v_locator )
, _u_locator ( u_locator )
, _ux_ssfactor( ux_ssfactor )
, _uy_ssfactor( uy_ssfactor )
, _vx_ssfactor( vx_ssfactor )
, _vy_ssfactor( vy_ssfactor )
{}

/// operator()
typename result_type operator()( const point_t& p ) const
{
boost::uint8 y = _y_locator.xy_at( p );
auto y = *_y_locator.xy_at( p );
auto v = *_v_locator.xy_at( p.x / _ux_ssfactor, p.y / _uy_ssfactor );
auto u = *_u_locator.xy_at( p.x / _vx_ssfactor, p.y / _vy_ssfactor );

return value_type();
return value_type( at_c<0>( y )
, at_c<0>( v )
, at_c<0>( u )
);
}

///
const Locator& y_locator() const { return _y_locator; }
const Locator& v_locator() const { return _v_locator; }
const Locator& u_locator() const { return _u_locator; }
const plane_locator_t& y_locator() const { return _y_locator; }
const plane_locator_t& v_locator() const { return _v_locator; }
const plane_locator_t& u_locator() const { return _u_locator; }

const std::size_t ux_ssfactor() const { return ux_ssfactor; }
const std::size_t uy_ssfactor() const { return uy_ssfactor; }
const std::size_t vx_ssfactor() const { return vx_ssfactor; }
const std::size_t vy_ssfactor() const { return vy_ssfactor; }

private:

Locator _y_locator;
Locator _v_locator;
Locator _u_locator;
plane_locator_t _y_locator;
plane_locator_t _v_locator;
plane_locator_t _u_locator;

std::size_t _ux_ssfactor;
std::size_t _uy_ssfactor;
std::size_t _vx_ssfactor;
std::size_t _vy_ssfactor;
};


Expand Down Expand Up @@ -135,6 +158,9 @@ class subsampled_image_view : public image_view< Locator >
: image_view< locator_t >( v )
{}

const point_t& v_ssfactors() const { return point_t( get_deref_fn().vx_ssfactor(), get_deref_fn().vx_ssfactor() ); }
const point_t& u_ssfactors() const { return point_t( get_deref_fn().ux_ssfactor(), get_deref_fn().ux_ssfactor() ); }

const point_t& y_dimension() const { return _y_dimensions; }
const point_t& v_dimension() const { return _v_dimensions; }
const point_t& u_dimension() const { return _u_dimensions; }
Expand Down Expand Up @@ -185,7 +211,8 @@ class subsampled_image
typedef typename plane_image_t::const_view_t plane_const_view_t;
typedef typename plane_view_t::locator plane_locator_t;

typedef typename subsampled_image_locator< plane_locator_t >::type locator_t;
typedef typename view_type_from_pixel< Pixel >::type pixel_view_t;
typedef typename subsampled_image_locator< typename pixel_view_t::locator >::type locator_t;

typedef typename plane_image_t::coord_t x_coord_t;
typedef typename plane_image_t::coord_t y_coord_t;
Expand All @@ -197,21 +224,20 @@ class subsampled_image
/// constructor
subsampled_image( const x_coord_t y_width
, const y_coord_t y_height
, const x_coord_t v_width
, const y_coord_t v_height
, const x_coord_t u_width
, const y_coord_t u_height
, const std::size_t y_alignment = 0
, const std::size_t v_alignment = 0
, const std::size_t u_alignment = 0
)
: _y_plane( y_width, y_height, y_alignment, Allocator() )
, _v_plane( v_width, v_height, v_alignment, Allocator() )
, _u_plane( u_width, u_height, u_alignment, Allocator() )
, const std::size_t vx_ssfactor = 2
, const std::size_t vy_ssfactor = 2
, const std::size_t ux_ssfactor = 2
, const std::size_t uy_ssfactor = 2
)
: _y_plane( y_width, y_height, 0, Allocator() )
, _v_plane( y_width / vx_ssfactor, y_height / vy_ssfactor, 0, Allocator() )
, _u_plane( y_width / ux_ssfactor, y_height / uy_ssfactor, 0, Allocator() )
{
init( point_t( y_width, y_height )
, point_t( v_width, v_height )
, point_t( u_width, u_height )
, vx_ssfactor
, vy_ssfactor
, ux_ssfactor
, uy_ssfactor
);
}

Expand All @@ -221,16 +247,22 @@ class subsampled_image

private:

void init( const point_t& y_dimensions
, const point_t& v_dimensions
, const point_t& u_dimensions
void init( const point_t& y_dimensions
, const std::size_t vx_ssfactor
, const std::size_t vy_ssfactor
, const std::size_t ux_ssfactor
, const std::size_t uy_ssfactor
)
{
typedef subsampled_image_deref_fn< plane_locator_t > defer_fn_t;
typedef subsampled_image_deref_fn< locator_t > defer_fn_t;

defer_fn_t deref_fn( view( _y_plane ).xy_at( 0, 0 )
, view( _v_plane ).xy_at( 0, 0 )
, view( _u_plane ).xy_at( 0, 0 )
, vx_ssfactor
, vy_ssfactor
, ux_ssfactor
, uy_ssfactor
);

// init a virtual_2d_locator
Expand All @@ -239,9 +271,9 @@ class subsampled_image
, deref_fn
);

_view = view_t( y_dimensions
, v_dimensions
, u_dimensions
_view = view_t( _y_plane.dimensions()
, _v_plane.dimensions()
, _u_plane.dimensions()
, locator
);
}
Expand Down Expand Up @@ -292,6 +324,71 @@ void fill_pixels( const subsampled_image_view< Locator >& view
fill_pixels( view.u_plane_view(), channel_t( at_c<2>( value )));
}

/////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup ImageViewConstructors
/// \brief Creates a subsampled view from a raw memory
/////////////////////////////////////////////////////////////////////////////////////////
//template< typename Pixel >
//typename subsampled_image< Pixel >::view_t subsampled_view( std::size_t y_width
// , std::size_t y_height
// , unsigned char* y_base
// , std::size_t vx_ssfactor = 2
// , std::size_t vy_ssfactor = 2
// , std::size_t ux_ssfactor = 2
// , std::size_t uy_ssfactor = 2
// )
//{
// std::size_t y_channel_size = 1;
// std::size_t u_channel_size = 1;
//
// unsigned char* u_base = y_base + ( y_width * y_height * y_channel_size );
// unsigned char* v_base = u_base + ( y_width / ux_ssfactor ) * ( y_height / uy_ssfactor ) * u_channel_size;
//
// typedef subsampled_image< Pixel >::plane_view_t plane_view_t;
//
// plane_view_t y_plane = interleaved_view( y_width
// , y_height
// , (plane_view_t::value_type*) y_base // pixels
// , y_width // rowsize_in_bytes
// );
//
// plane_view_t v_plane = interleaved_view( y_width / vx_ssfactor
// , y_height / vy_ssfactor
// , (plane_view_t::value_type*) v_base // pixels
// , y_width // rowsize_in_bytes
// );
//
// plane_view_t u_plane = interleaved_view( y_width / ux_ssfactor
// , y_height / uy_ssfactor
// , (plane_view_t::value_type*) u_base // pixels
// , y_width // rowsize_in_bytes
// );
//
// typedef subsampled_image_deref_fn< subsampled_image< Pixel >::locator_t > defer_fn_t;
// defer_fn_t deref_fn( y_plane.xy_at( 0, 0 )
// , v_plane.xy_at( 0, 0 )
// , u_plane.xy_at( 0, 0 )
// , vx_ssfactor
// , vy_ssfactor
// , ux_ssfactor
// , uy_ssfactor
// );
//
//
// typedef subsampled_image< Pixel >::locator_t locator_t;
// locator_t locator( point_t( 0, 0 ) // p
// , point_t( 1, 1 ) // step
// , deref_fn
// );
//
// typedef subsampled_image< Pixel >::view_t view_t;
// return view_t( point_t( y_width, y_height )
// , point_t( y_width / vx_ssfactor, y_height / vy_ssfactor )
// , point_t( y_width / ux_ssfactor, y_height / uy_ssfactor )
// , locator
// );
//}


} // namespace gil
} // namespace boost
Expand Down
12 changes: 12 additions & 0 deletions include/boost/gil/gil_concept.hpp
Expand Up @@ -32,6 +32,14 @@
#include <boost/mpl/size.hpp>

namespace boost { namespace gil {

#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
#pragma warning(push)
#pragma warning(disable:4510) //default constructor could not be generated
#pragma warning(disable:4512) //assignment operator could not be generated
#pragma warning(disable:4610) //can never be instantiated - user defined constructor required
#endif

template <typename T> struct channel_traits;
template <typename P> struct is_pixel;
template <typename dstT, typename srcT>
Expand Down Expand Up @@ -2183,6 +2191,10 @@ struct ImageConcept {
Img img;
};

#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
#pragma warning(pop)
#endif


} } // namespace boost::gil

Expand Down
16 changes: 0 additions & 16 deletions include/boost/gil/gil_config.hpp
Expand Up @@ -25,22 +25,6 @@

#define GIL_VERSION "2.1.2"

#ifdef _DEBUG
# define GIL_FORCEINLINE inline
#else
#ifdef NDEBUG
#if defined(_MSC_VER)
# define GIL_FORCEINLINE __forceinline
#elif defined(__GNUC__) && __GNUC__ > 3
# define GIL_FORCEINLINE inline __attribute__ ((always_inline))
#else
# define GIL_FORCEINLINE inline
#endif
#else
# define GIL_FORCEINLINE inline
#endif
#endif

// Enable GIL_NONWORD_POINTER_ALIGNMENT_SUPPORTED if your platform supports dereferencing on non-word memory boundary.
// Enabling the flag results in performance improvement
#if !defined(__hpux) && !defined(sun) && !defined(__sun) && !defined(__osf__)
Expand Down
2 changes: 1 addition & 1 deletion include/boost/gil/iterator_from_2d.hpp
Expand Up @@ -105,7 +105,7 @@ class iterator_from_2d : public iterator_facade<iterator_from_2d<Loc2>,
}
}

GIL_FORCEINLINE void advance(difference_type d) {
BOOST_FORCEINLINE void advance(difference_type d) {
if (_width==0) return; // unfortunately we need to check for that. Default-constructed images have width of 0 and the code below will throw if executed.
point_t delta;
if (_coords.x+d>=0) { // not going back to a previous row?
Expand Down
4 changes: 3 additions & 1 deletion include/boost/gil/packed_pixel.hpp
Expand Up @@ -81,7 +81,9 @@ struct packed_pixel {
}
packed_pixel(int chan0, int chan1, int chan2) : _bitfield(0) {
BOOST_STATIC_ASSERT((num_channels<packed_pixel>::value==3));
gil::at_c<0>(*this)=chan0; gil::at_c<1>(*this)=chan1; gil::at_c<2>(*this)=chan2;
gil::at_c<0>(*this) = chan0;
gil::at_c<1>(*this) = chan1;
gil::at_c<2>(*this) = chan2;
}
packed_pixel(int chan0, int chan1, int chan2, int chan3) : _bitfield(0) {
BOOST_STATIC_ASSERT((num_channels<packed_pixel>::value==4));
Expand Down
24 changes: 12 additions & 12 deletions include/boost/gil/utilities.hpp
Expand Up @@ -96,36 +96,36 @@ template <typename T>
T point2<T>::* const point2<T>::mem_array[point2<T>::num_dimensions] = { &point2<T>::x, &point2<T>::y };

/// \ingroup PointModel
template <typename T> GIL_FORCEINLINE
template <typename T> BOOST_FORCEINLINE
bool operator==(const point2<T>& p1, const point2<T>& p2) { return (p1.x==p2.x && p1.y==p2.y); }
/// \ingroup PointModel
template <typename T> GIL_FORCEINLINE
template <typename T> BOOST_FORCEINLINE
bool operator!=(const point2<T>& p1, const point2<T>& p2) { return p1.x!=p2.x || p1.y!=p2.y; }
/// \ingroup PointModel
template <typename T> GIL_FORCEINLINE
template <typename T> BOOST_FORCEINLINE
point2<T> operator+(const point2<T>& p1, const point2<T>& p2) { return point2<T>(p1.x+p2.x,p1.y+p2.y); }
/// \ingroup PointModel
template <typename T> GIL_FORCEINLINE
template <typename T> BOOST_FORCEINLINE
point2<T> operator-(const point2<T>& p) { return point2<T>(-p.x,-p.y); }
/// \ingroup PointModel
template <typename T> GIL_FORCEINLINE
template <typename T> BOOST_FORCEINLINE
point2<T> operator-(const point2<T>& p1, const point2<T>& p2) { return point2<T>(p1.x-p2.x,p1.y-p2.y); }
/// \ingroup PointModel
template <typename T> GIL_FORCEINLINE
template <typename T> BOOST_FORCEINLINE
point2<double> operator/(const point2<T>& p, double t) { return t==0 ? point2<double>(0,0):point2<double>(p.x/t,p.y/t); }
/// \ingroup PointModel
template <typename T> GIL_FORCEINLINE
template <typename T> BOOST_FORCEINLINE
point2<T> operator*(const point2<T>& p, std::ptrdiff_t t) { return point2<T>(p.x*t,p.y*t); }
/// \ingroup PointModel
template <typename T> GIL_FORCEINLINE
template <typename T> BOOST_FORCEINLINE
point2<T> operator*(std::ptrdiff_t t, const point2<T>& p) { return point2<T>(p.x*t,p.y*t); }

/// \ingroup PointModel
template <std::size_t K, typename T> GIL_FORCEINLINE
template <std::size_t K, typename T> BOOST_FORCEINLINE
const T& axis_value(const point2<T>& p) { return p[K]; }

/// \ingroup PointModel
template <std::size_t K, typename T> GIL_FORCEINLINE
template <std::size_t K, typename T> BOOST_FORCEINLINE
T& axis_value( point2<T>& p) { return p[K]; }

////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -213,10 +213,10 @@ class deref_compose : public deref_base<
};

// reinterpret_cast is implementation-defined. Static cast is not.
template <typename OutPtr, typename In> GIL_FORCEINLINE
template <typename OutPtr, typename In> BOOST_FORCEINLINE
OutPtr gil_reinterpret_cast( In* p) { return static_cast<OutPtr>(static_cast<void*>(p)); }

template <typename OutPtr, typename In> GIL_FORCEINLINE
template <typename OutPtr, typename In> BOOST_FORCEINLINE
const OutPtr gil_reinterpret_cast_c(const In* p) { return static_cast<const OutPtr>(static_cast<const void*>(p)); }

namespace detail {
Expand Down