Skip to content

Commit

Permalink
Merge pull request #65 from leapmotion/bug-libstdcpp-enum
Browse files Browse the repository at this point in the history
Correcting libstdc++ compiler error
  • Loading branch information
Gabriel Hare committed Aug 20, 2014
2 parents 957d203 + 9021cbe commit 21c2c12
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
19 changes: 15 additions & 4 deletions autowiring/MicroBolt.h
Expand Up @@ -17,15 +17,26 @@ template<typename T, typename... Sigils>
struct MicroBolt:
public Bolt<Sigils...>
{
private:
template<class W>
static bool LoopInject(const std::shared_ptr<CoreContext>& ctxt) {
for(auto context : ContextEnumeratorT<W>(ctxt))
// Inject<W>() is idempotent, that makes this behavior safe
context->template Inject<T>();
return true;
}

public:
MicroBolt(void) {
// ASSERT: Inject<T>() is idempotent.
// NOTE: Injection of T into all matching contexts may result in
// multiple calls to Inject<T>() if a matching context
// is created during traversal.
for(auto findSigil : {ContextEnumeratorT<Sigils>(CoreContext::CurrentContext())...})
for(auto context : findSigil)
context->template Inject<T>();
const auto ctxt = CoreContext::CurrentContext();
const bool dummy [] = {
LoopInject<Sigils>(ctxt)...,
false
};
(void)dummy;
}
void ContextCreated(void) override;
};
Expand Down
1 change: 1 addition & 0 deletions src/autowiring/test/BoltTest.cpp
Expand Up @@ -211,6 +211,7 @@ class TargetBoltable: public Boltable<target> {
TargetBoltable() {++numCons;}
~TargetBoltable() {++numDest;}
};

template<class target>
int TargetBoltable<target>::numCons = 0;
template<class target>
Expand Down

0 comments on commit 21c2c12

Please sign in to comment.