| Home | Libraries | People | FAQ | More

##### BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED

Macro to register a templated linestring.

###### Description

The macro BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED registers a templated linestring such that it is recognized by Boost.Geometry and that Boost.Geometry functionality can used with the specified type. The type must have one template parameter, which should be a point type, and should not be specified. Boost.Geometry takes care of inserting the template parameter. Hence all types of this templated linestring are registered, regardless of their point type.

###### Synopsis

    #define BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(Linestring)

###### Parameters

Name | Description
--- | ---
Linestring | linestring (without template parameters) type to be registered

###### Header

`#include <boost/geometry/geometries/register/linestring.hpp>`

###### Example

Show the use of the macro BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED

    #include <iostream>
    #include <deque>

    #include <boost/geometry.hpp>
    #include <boost/geometry/geometries/point_xy.hpp>
    #include <boost/geometry/geometries/register/linestring.hpp>

    // Adapt any deque to Boost.Geometry Linestring Concept
    BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::deque)

    int main()
    {
        std::deque<boost::geometry::model::d2::point_xy<double> > line(2);
        boost::geometry::assign_values(line[0], 1, 1);
        boost::geometry::assign_values(line[1], 2, 2);

        // Boost.Geometry algorithms work on any deque now
        std::cout << "Length: "  << boost::geometry::length(line) << std::endl;
        std::cout << "Line: "  << boost::geometry::dsv(line) << std::endl;

        return 0;
    }

Output:

    Length: 1.41421
    Line: ((1, 1), (2, 2))