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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

C array

C arrays are adapted to the Boost.Geometry point concept


C arrays, such as double[2] or int[3], are (optionally) adapted to the Boost.Geometry point concept. They can therefore be used in many Boost.Geometry algorithms.

Note that a C array cannot be the point type of a linestring or a polygon. The reason for that is that a std::vector does not allow containing C arrays (this is not related to Boost.Geometry). The C array is therefore limited to the point type.

Model of

Point Concept


#include <boost/geometry/geometries/adapted/c_array.hpp>

The standard header boost/geometry.hpp does not include this header.


Small example showing the combination of an array with a Boost.Geometry algorithm

#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/adapted/c_array.hpp>


int main()
    int a[3] = {1, 2, 3};
    int b[3] = {2, 3, 4};

    std::cout << boost::geometry::distance(a, b) << std::endl;

    return 0;