From 3e5c89f64324021550feb8b7a0d44b92a29e224b Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Fri, 4 May 2018 17:06:18 +1000 Subject: [PATCH] coord/ops: add lshift --- coord/ops.hpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/coord/ops.hpp b/coord/ops.hpp index 7c7e9cb5..af3c447f 100644 --- a/coord/ops.hpp +++ b/coord/ops.hpp @@ -1426,7 +1426,23 @@ namespace util { { return rshift (k, num, K {fill}); } -} + + + template < + typename K, + typename = std::enable_if_t< + is_coord_v + > + > + constexpr auto + lshift (const K k, const int places, typename K::value_type fill) + { + K res {}; + std::copy_n (std::cbegin (k) + places, K::elements - places, std::begin (res)); + std::fill_n (std::begin (res) + K::elements - places, places, fill); + return res; + } +}; ///////////////////////////////////////////////////////////////////////////////