From 2210db9c4e5f3abf8a069df17f93b608762ae1ce Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 19 Jan 2015 13:26:33 +1100 Subject: [PATCH] point: add a cast method --- point.hpp | 2 ++ point.ipp | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/point.hpp b/point.hpp index 75402b90..ba3dab8a 100644 --- a/point.hpp +++ b/point.hpp @@ -63,6 +63,8 @@ namespace util { static const point ORIGIN; + template point cast (void) const; + void sanity (void) const; }; diff --git a/point.ipp b/point.ipp index 12c0b912..22e3b295 100644 --- a/point.ipp +++ b/point.ipp @@ -93,4 +93,18 @@ namespace util { out.data + L1); return out; } + + + //------------------------------------------------------------------------- + template + template + point + point::cast (void) const + { + point out; + std::copy (std::begin (this->data), + std::end (this->data), + std::begin (out.data)); + return out; + } }