/usr/include/boost/gil/concepts
Edit: /usr/include/boost/gil/concepts/point.hpp (3090B)
//
// Copyright 2005-2007 Adobe Systems Incorporated
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
#ifndef BOOST_GIL_CONCEPTS_POINT_HPP
#define BOOST_GIL_CONCEPTS_POINT_HPP
#include
#include
#include
#if defined(BOOST_CLANG)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wunused-local-typedefs"
#endif
#if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#endif
namespace boost { namespace gil {
// Forward declarations
template
class point;
template
T const& axis_value(point const& p);
template
T& axis_value(point& p);
/// \brief N-dimensional point concept
/// \code
/// concept PointNDConcept : Regular
/// {
/// // the type of a coordinate along each axis
/// template
/// struct axis; where Metafunction;
///
/// const size_t num_dimensions;
///
/// // accessor/modifier of the value of each axis.
///
/// template
/// typename axis::type const& T::axis_value() const;
///
/// template
/// typename axis::type& T::axis_value();
/// };
/// \endcode
/// \ingroup PointConcept
///
template
struct PointNDConcept
{
void constraints()
{
gil_function_requires>();
using value_type = typename P::value_type;
ignore_unused_variable_warning(value_type{});
static const std::size_t N = P::num_dimensions;
ignore_unused_variable_warning(N);
using FT = typename P::template axis<0>::coord_t;
using LT = typename P::template axis::coord_t;
FT ft = gil::axis_value<0>(point);
axis_value<0>(point) = ft;
LT lt = axis_value(point);
axis_value(point) = lt;
//value_type v=point[0];
//ignore_unused_variable_warning(v);
}
P point;
};
/// \brief 2-dimensional point concept
/// \code
/// concept Point2DConcept : PointNDConcept
/// {
/// where num_dimensions == 2;
/// where SameType::type, axis<1>::type>;
///
/// typename value_type = axis<0>::type;
///
/// value_type const& operator[](T const&, size_t i);
/// value_type& operator[](T&, size_t i);
///
/// value_type x,y;
/// };
/// \endcode
/// \ingroup PointConcept
///
template
struct Point2DConcept
{
void constraints()
{
gil_function_requires>();
static_assert(P::num_dimensions == 2, "");
point.x = point.y;
point[0] = point[1];
}
P point;
};
}} // namespace boost::gil
#if defined(BOOST_CLANG)
#pragma clang diagnostic pop
#endif
#if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
#pragma GCC diagnostic pop
#endif
#endif