summaryrefslogtreecommitdiffstats
path: root/src/Generating/IntGen.h
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2015-03-01 15:51:07 +0100
committerTycho <work.tycho+git@gmail.com>2015-03-01 15:51:07 +0100
commitbdea6c92b32630856449962ee331fb475627e8d0 (patch)
tree9e8bdba14ce62ffa7ea23ccaadda29072e7c2f85 /src/Generating/IntGen.h
parentAdded pipelining syntax for generators (diff)
downloadcuberite-bdea6c92b32630856449962ee331fb475627e8d0.tar
cuberite-bdea6c92b32630856449962ee331fb475627e8d0.tar.gz
cuberite-bdea6c92b32630856449962ee331fb475627e8d0.tar.bz2
cuberite-bdea6c92b32630856449962ee331fb475627e8d0.tar.lz
cuberite-bdea6c92b32630856449962ee331fb475627e8d0.tar.xz
cuberite-bdea6c92b32630856449962ee331fb475627e8d0.tar.zst
cuberite-bdea6c92b32630856449962ee331fb475627e8d0.zip
Diffstat (limited to 'src/Generating/IntGen.h')
-rw-r--r--src/Generating/IntGen.h26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/Generating/IntGen.h b/src/Generating/IntGen.h
index be005b314..4fce3ba08 100644
--- a/src/Generating/IntGen.h
+++ b/src/Generating/IntGen.h
@@ -71,14 +71,17 @@ public:
};
template<size_t size, class... Args>
-struct PackToInt {
- enum {
+struct PackToInt
+{
+ enum
+ {
value = size - sizeof...(Args),
};
};
template<class Gen, class... Args>
-class cIntGenFactory {
+class cIntGenFactory
+{
public:
@@ -88,13 +91,10 @@ public:
m_args(std::make_tuple<Args...>(std::forward<Args>(a_args)...))
{
}
-
- //X >> Y
- //Y(X)
- //cIntGenFactory<cIntGenZoom<10, 10>, int>::construct<std::shared_ptr<cIntGenChoice<2, 7, 7> > >
-
- template<class LhsGen>
- std::shared_ptr<Gen> construct(LhsGen&& lhs) {
+
+ template <class LhsGen>
+ std::shared_ptr<Gen> construct(LhsGen&& lhs)
+ {
return std::make_shared<Gen>(std::get<PackToInt<sizeof...(Args), Args>::value>(m_args)..., std::forward<LhsGen>(lhs));
}
@@ -104,12 +104,14 @@ private:
};
template<class T, class RhsGen, class... Args>
-std::shared_ptr<RhsGen> operator>> (std::shared_ptr<T> lhs, cIntGenFactory<RhsGen, Args...> rhs) {
+std::shared_ptr<RhsGen> operator>> (std::shared_ptr<T> lhs, cIntGenFactory<RhsGen, Args...> rhs)
+{
return rhs.construct(static_cast<std::shared_ptr<typename T::IntGenType>>(lhs));
}
template<class Gen, class... Args>
-cIntGenFactory<Gen, Args...> MakeIntGen(Args&&... args) {
+cIntGenFactory<Gen, Args...> MakeIntGen(Args&&... args)
+{
return cIntGenFactory<Gen, Args...>(std::forward<Args>(args)...);
}