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

Added namespace-scope definitions for constexpr static members #603

Merged
merged 3 commits into from
Feb 23, 2016
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions dart/dynamics/detail/Addon.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,25 @@
namespace dart {
namespace dynamics {

//==============================================================================
//
// These namespace-level definitions are required to enable ODR-use of static
// constexpr member variables.
//
// See this StackOverflow answer: http://stackoverflow.com/a/14396189/111426
//
template <class BaseT, typename PropertiesDataT,
class ManagerT, void (*updateProperties)(BaseT*), bool OptionalT>
constexpr void (*AddonWithProtectedPropertiesInSkeleton<
BaseT, PropertiesDataT, ManagerT, updateProperties, OptionalT>
::UpdateProperties)(BaseT*);

//==============================================================================
template <class BaseT, typename PropertiesDataT,
class ManagerT, void (*updateProperties)(BaseT*), bool OptionalT>
constexpr bool AddonWithProtectedPropertiesInSkeleton<
BaseT, PropertiesDataT, ManagerT, updateProperties, OptionalT>::Optional;

//==============================================================================
template <class BaseT, typename PropertiesDataT,
class ManagerT, void (*updateProperties)(BaseT*), bool OptionalT>
Expand Down Expand Up @@ -198,6 +217,37 @@ setManager(common::AddonManager* newManager, bool /*transfer*/)
}
}

//==============================================================================
//
// These namespace-level definitions are required to enable ODR-use of static
// constexpr member variables.
//
// See this StackOverflow answer: http://stackoverflow.com/a/14396189/111426
//
template <class BaseT, typename StateDataT, typename PropertiesDataT,
class ManagerT, void (*updateState)(BaseT*),
void (*updateProperties)(BaseT*), bool OptionalT>
constexpr void (*AddonWithProtectedStateAndPropertiesInSkeleton<
BaseT, StateDataT, PropertiesDataT,
ManagerT, updateState, updateProperties, OptionalT>::UpdateState)(BaseT*);

//==============================================================================
template <class BaseT, typename StateDataT, typename PropertiesDataT,
class ManagerT, void (*updateState)(BaseT*),
void (*updateProperties)(BaseT*), bool OptionalT>
constexpr void (*AddonWithProtectedStateAndPropertiesInSkeleton<
BaseT, StateDataT, PropertiesDataT,
ManagerT, updateState, updateProperties, OptionalT>::
UpdateProperties)(BaseT*);

//==============================================================================
template <class BaseT, typename StateDataT, typename PropertiesDataT,
class ManagerT, void (*updateState)(BaseT*),
void (*updateProperties)(BaseT*), bool OptionalT>
constexpr bool AddonWithProtectedStateAndPropertiesInSkeleton<
BaseT, StateDataT, PropertiesDataT,
ManagerT, updateState, updateProperties, OptionalT>::Optional;

//==============================================================================
template <class BaseT, typename StateDataT, typename PropertiesDataT,
class ManagerT, void (*updateState)(BaseT*),
Expand Down
10 changes: 10 additions & 0 deletions dart/dynamics/detail/MultiDofJoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@
namespace dart {
namespace dynamics {

//==============================================================================
//
// These namespace-level definitions are required to enable ODR-use of static
// constexpr member variables.
//
// See this StackOverflow answer: http://stackoverflow.com/a/14396189/111426
//
template <size_t DOF>
constexpr size_t MultiDofJoint<DOF>::NumDofs;

//==============================================================================
template <size_t DOF>
MultiDofJoint<DOF>::~MultiDofJoint()
Expand Down
20 changes: 20 additions & 0 deletions dart/dynamics/detail/MultiDofJointProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,16 @@ class MultiDofJointAddon final :
std::string& _getDofNameReference(size_t index);
};

//==============================================================================
//
// These namespace-level definitions are required to enable ODR-use of static
// constexpr member variables.
//
// See this StackOverflow answer: http://stackoverflow.com/a/14396189/111426
//
template <size_t DOF>
constexpr size_t MultiDofJointUniqueProperties<DOF>::NumDofs;

//==============================================================================
template <size_t DOF>
MultiDofJointUniqueProperties<DOF>::MultiDofJointUniqueProperties(
Expand Down Expand Up @@ -278,6 +288,16 @@ MultiDofJointProperties<DOF>::MultiDofJointProperties(
// Do nothing
}

//==============================================================================
//
// These namespace-level definitions are required to enable ODR-use of static
// constexpr member variables.
//
// See this StackOverflow answer: http://stackoverflow.com/a/14396189/111426
//
template <size_t DOF>
constexpr size_t MultiDofJointAddon<DOF>::NumDofs;

//==============================================================================
template <size_t DOF>
MultiDofJointAddon<DOF>::MultiDofJointAddon(
Expand Down