| Home | Libraries | People | FAQ | More

#### model::multi_point

multi_point, a collection of points

###### Model of

MultiPoint Concept

###### Synopsis

    template<typename Point, template< typename, typename > class Container, template< typename > class Allocator>
    class model::multi_point
          : public std::vector< Point, std::allocator< Point > >
    {
      // ...
    };

###### Template parameter(s)

Parameter | Default | Description
--- | --- | ---
typename Point |  | Any type fulfilling a Point Concept
template< typename, typename > class Container | std::vector | container type, for example std::vector, std::deque
template< typename > class Allocator | std::allocator | container-allocator-type

###### Constructor(s)

Function | Description | Parameters
--- | --- | ---
    multi_point()
| Default constructor, creating an empty multi_point. |
    template<typename Iterator>
    multi_point(Iterator begin, Iterator end)
| Constructor with begin and end, filling the multi_point. | Iterator: begin: Iterator: end:
    multi_point(std::initializer_list< Point > l)
| Constructor taking std::initializer_list, filling the multi_point. | std::initializer_list< Point >: l:

###### Header

Either

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

Or

`#include <boost/geometry/geometries/multi_point.hpp>`

###### Examples

Declaration and use of the Boost.Geometry model::multi_point, modelling the MultiPoint Concept

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

    namespace bg = boost::geometry;

    int main()
    {
        using point_t = bg::model::point<double, 2, bg::cs::cartesian>;
        using mpoint_t = bg::model::multi_point<point_t>;

        mpoint_t mpt1;
        mpoint_t mpt2{{{0.0, 0.0}, {1.0, 1.0}, {2.0, 2.0}}};

        bg::append(mpt1, point_t(0.0, 0.0));
        bg::append(mpt1, point_t(1.0, 1.0));
        bg::append(mpt1, point_t(2.0, 2.0));

        std::size_t count = bg::num_points(mpt1);

        std::cout << count << std::endl;

        return 0;
    }

| Default-construct a multi_point.
| Construct a multi_point containing three points, using C++11 unified initialization syntax.
| Append point to the multi_point.

Output:

    3