geom/traits: add initial shape_traits trait

This commit is contained in:
Danny Robson 2019-08-30 10:15:26 +10:00
parent 33b141eb3a
commit 979deaa4aa
2 changed files with 31 additions and 0 deletions

View File

@ -363,6 +363,7 @@ list (
geom/segment.hpp
geom/sphere.cpp
geom/sphere.hpp
geom/traits.hpp
geom/tri.cpp
geom/tri.hpp
hash.hpp

30
geom/traits.hpp Normal file
View File

@ -0,0 +1,30 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright 2019 Danny Robson <danny@nerdcruft.net>
*/
#pragma once
#include "fwd.hpp"
#include "../point.hpp"
#include <cstddef>
namespace cruft::geom {
template <typename ShapeT>
struct shape_traits { };
template <std::size_t S, typename T>
struct shape_traits <::cruft::region<S,T>> {
static constexpr auto elements = S;
using value_type = T;
using point_type = cruft::point<S,T>;
};
}