CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
Utility.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include <utility>
11
13
16 template<typename Generator> class GeneratedType {
17 public:
18 using Type = decltype(std::declval<const Generator*>()->generate());
19 };
20
23 template<typename Primitive> class EdgeGeneratorType {
24 public:
25 using Type = decltype(std::declval<const Primitive*>()->edges());
26 };
27
30 template<typename Primitive> class TriangleGeneratorType {
31 public:
32 using Type = decltype(std::declval<const Primitive*>()->triangles());
33 };
34
37 template<typename Primitive> class VertexGeneratorType {
38 public:
39 using Type = decltype(std::declval<const Primitive*>()->vertices());
40 };
41
43 template<typename Generator> int count(const Generator& generator) noexcept {
45 int c = 0;
46 while(!temp.done()) {
47 ++c;
48 temp.next();
49 }
50 return c;
51 }
52
53} // namespace CeresEngine::MeshGenerator
A generator represents a coroutine type that produces a sequence of values of type T,...
Definition Generator.hpp:50
Will have a type named "Type" that has same type as value returned by method edges() for type Primiti...
Definition Utility.hpp:23
decltype(std::declval< const Primitive * >() ->edges()) Type
Definition Utility.hpp:25
Will have a type named "Type" that has same type as value returned by method generate() of type Gener...
Definition Utility.hpp:16
decltype(std::declval< const Generator * >() ->generate()) Type
Definition Utility.hpp:18
Will have a type named "Type" that has same type as value returned by method triangles() for type Pri...
Definition Utility.hpp:30
decltype(std::declval< const Primitive * >() ->triangles()) Type
Definition Utility.hpp:32
Will have a type named "Type" that has same type as value returned by method vertices() for type Prim...
Definition Utility.hpp:37
decltype(std::declval< const Primitive * >() ->vertices()) Type
Definition Utility.hpp:39
Definition AnyGenerator.hpp:12
constexpr CountAlgorithmFunctor count
Returns the number of elements matching an element.
Definition Count.hpp:82
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25