use inheritance to define geometry ( struct geometry : geometry_base<T> ) + provide value_type type alias in geometry
This commit is contained in:
parent
d209e5bc33
commit
89d258743a
1 changed files with 22 additions and 8 deletions
|
@ -129,15 +129,29 @@ struct geometry_collection;
|
|||
|
||||
struct geometry_empty {};
|
||||
|
||||
|
||||
template <typename T>
|
||||
using geometry = mapnik::util::variant<geometry_empty,
|
||||
point<T>,
|
||||
line_string<T>,
|
||||
polygon<T>,
|
||||
multi_point<T>,
|
||||
multi_line_string<T>,
|
||||
multi_polygon<T>,
|
||||
mapnik::util::recursive_wrapper<geometry_collection<T> > >;
|
||||
using geometry_base = mapnik::util::variant<geometry_empty,
|
||||
point<T>,
|
||||
line_string<T>,
|
||||
polygon<T>,
|
||||
multi_point<T>,
|
||||
multi_line_string<T>,
|
||||
multi_polygon<T>,
|
||||
mapnik::util::recursive_wrapper<geometry_collection<T> > >;
|
||||
template <typename T>
|
||||
struct geometry : geometry_base<T>
|
||||
{
|
||||
using value_type = T;
|
||||
|
||||
geometry()
|
||||
: geometry_base<T>() {} // empty
|
||||
|
||||
template <typename G>
|
||||
geometry(G && geom)
|
||||
: geometry_base<T>(std::forward<G>(geom)) {}
|
||||
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct geometry_collection : std::vector<geometry<T>> {};
|
||||
|
|
Loading…
Reference in a new issue