From b67a99ee4e8a031a1ecaef3aa3cd8dfc4d3945c2 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 23 Mar 2017 14:36:39 +1100 Subject: [PATCH] coord: add arity query function --- coord/ops.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/coord/ops.hpp b/coord/ops.hpp index 800fb1bb..dcf0afa6 100644 --- a/coord/ops.hpp +++ b/coord/ops.hpp @@ -87,6 +87,27 @@ namespace util { constexpr bool is_coord_v = is_coord::value; + + /////////////////////////////////////////////////////////////////////////// + template + constexpr + std::enable_if_t, std::size_t> + arity (void) + { + return T::dimension; + } + + + //------------------------------------------------------------------------- + template + constexpr + std::enable_if_t::value, std::size_t> + arity (void) + { + return 1; + } + + /////////////////////////////////////////////////////////////////////////// // vector operators #define ELEMENT_OP(OP) \