Skip to content

Commit

Permalink
Replace lambda function parameter with static member function (#916)
Browse files Browse the repository at this point in the history
  • Loading branch information
jslee02 committed Sep 29, 2017
1 parent 31db2d4 commit b8b4a14
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
3 changes: 3 additions & 0 deletions dart/common/Factory.hpp
Expand Up @@ -98,6 +98,9 @@ class Factory
// (see: https://github.com/dartsim/dart/pull/845)

private:
template <typename Derived>
static HeldT defaultCreator(Args&&... args);

/// Object creator function map.
CreatorMap mCreatorMap;
};
Expand Down
18 changes: 13 additions & 5 deletions dart/common/detail/Factory-impl.hpp
Expand Up @@ -113,11 +113,7 @@ void Factory<KeyT, BaseT, HeldT, Args...>::registerCreator(
{
return registerCreator(
key,
[](Args&&... args) -> HeldT
{
return detail::DefaultCreator<Derived, HeldT, Args...>::run(
std::forward<Args>(args)...);
}
&Factory::defaultCreator<Derived>
);
}

Expand Down Expand Up @@ -178,6 +174,18 @@ HeldT Factory<KeyT, BaseT, HeldT, Args...>::create(
return it->second(std::forward<Args>(args)...);
}

//==============================================================================
template <typename KeyT,
typename BaseT,
typename HeldT,
typename... Args>
template <typename Derived>
HeldT Factory<KeyT, BaseT, HeldT, Args...>::defaultCreator(Args&&... args)
{
return detail::DefaultCreator<Derived, HeldT, Args...>::run(
std::forward<Args>(args)...);
}

//==============================================================================
template <typename KeyT,
typename BaseT,
Expand Down

0 comments on commit b8b4a14

Please sign in to comment.