Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chimera friendly version #916

Merged
merged 2 commits into from Sep 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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