From bdea6c92b32630856449962ee331fb475627e8d0 Mon Sep 17 00:00:00 2001 From: Tycho Date: Sun, 1 Mar 2015 14:51:07 +0000 Subject: Fixed Style Still fails CheckBasicStyle.lua dua to issue with rvalue references and templates --- src/Generating/BioGen.cpp | 2 +- src/Generating/IntGen.h | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp index a3cc20247..a830f6a43 100644 --- a/src/Generating/BioGen.cpp +++ b/src/Generating/BioGen.cpp @@ -942,7 +942,7 @@ public: { auto FinalRivers = - std::make_shared>(a_Seed + 12) + std::make_shared>(a_Seed + 12) >> MakeIntGen>(a_Seed + 11) >> MakeIntGen>(a_Seed + 6) >> MakeIntGen>(a_Seed + 5) 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 -struct PackToInt { - enum { +struct PackToInt +{ + enum + { value = size - sizeof...(Args), }; }; template -class cIntGenFactory { +class cIntGenFactory +{ public: @@ -88,13 +91,10 @@ public: m_args(std::make_tuple(std::forward(a_args)...)) { } - - //X >> Y - //Y(X) - //cIntGenFactory, int>::construct > > - - template - std::shared_ptr construct(LhsGen&& lhs) { + + template + std::shared_ptr construct(LhsGen&& lhs) + { return std::make_shared(std::get::value>(m_args)..., std::forward(lhs)); } @@ -104,12 +104,14 @@ private: }; template -std::shared_ptr operator>> (std::shared_ptr lhs, cIntGenFactory rhs) { +std::shared_ptr operator>> (std::shared_ptr lhs, cIntGenFactory rhs) +{ return rhs.construct(static_cast>(lhs)); } template -cIntGenFactory MakeIntGen(Args&&... args) { +cIntGenFactory MakeIntGen(Args&&... args) +{ return cIntGenFactory(std::forward(args)...); } -- cgit v1.2.3