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 a snapshot of the develop branch, built from commit 22f45db8cd.


Boost.Fusion adapted structs or classes are adapted to the Boost.Geometry point concept


Boost.Fusion adapted structs are (optionally) adapted to the Boost.Geometry point concept. They can therefore be used in many Boost.Geometry algorithms.

Model of

Point Concept


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

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


Shows how to combine Boost.Fusion with Boost.Geometry

#include <iostream>

#include <boost/fusion/include/adapt_struct_named.hpp>

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

struct sample_point
    double x, y, z;

BOOST_FUSION_ADAPT_STRUCT(sample_point, (double, x) (double, y) (double, z))

int main()
    sample_point a, b, c;

    // Set coordinates the Boost.Geometry way (one of the ways)
    boost::geometry::assign_values(a, 3, 2, 1);

    // Set coordinates the Boost.Fusion way
    boost::fusion::at_c<0>(b) = 6;
    boost::fusion::at_c<1>(b) = 5;
    boost::fusion::at_c<2>(b) = 4;

    // Set coordinates the native way
    c.x = 9;
    c.y = 8;
    c.z = 7;

    std::cout << "Distance a-b: " << boost::geometry::distance(a, b) << std::endl;
    std::cout << "Distance a-c: " << boost::geometry::distance(a, c) << std::endl;

    return 0;


Distance a-b: 5.19615
Distance a-c: 10.3923