Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

coordinate_type

Metafunction defining type as the coordinate type (int, float, double, etc) of the point type making up the specified geometry type.

Synopsis

template<typename Geometry>
struct coordinate_type
{
  // ...
};

Template parameter(s)

Parameter

Description

typename Geometry

Any type fulfilling a Geometry Concept

Header

#include <boost/geometry/core/coordinate_type.hpp>

Complexity

Compile time

Example

Examine the coordinate type of a point

#include <iostream>
#include <typeinfo>

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/point_xy.hpp>

int main()
{
    typedef boost::geometry::model::d2::point_xy<double> point_type;
    typedef boost::geometry::model::polygon<point_type> polygon_type;

    typedef boost::geometry::coordinate_type<polygon_type>::type ctype;

    std::cout << "type: " << typeid(ctype).name() << std::endl;

    return 0;
}

Output (using MSVC):

type: double

PrevUpHomeNext