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
This is an older version of Boost and was released in 2024. The current version is 1.89.0.
Metafunction defining value as the number of coordinates (the number of axes of any geometry) of the point type making up the specified geometry type.
template<typename Geometry> struct dimension : public core_dispatch::dimension< tag_t< Geometry >, util::remove_cptrref_t< Geometry > > { // ... };
|
Parameter |
Description |
|---|---|
|
typename Geometry |
Any type fulfilling a Geometry Concept |
Either
#include <boost/geometry.hpp>
Or
#include <boost/geometry/core/coordinate_dimension.hpp>
Compile time
Examine the number of coordinates making up the points in a linestring type
#include <iostream> #include <boost/geometry.hpp> #include <boost/geometry/geometries/linestring.hpp> #include <boost/geometry/geometries/adapted/boost_tuple.hpp> BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian); int main() { int dim = boost::geometry::dimension < boost::geometry::model::linestring < boost::tuple<float, float, float> > >::value; std::cout << "dimensions: " << dim << std::endl; return 0; }
Output:
dimensions: 3