diff --git a/CHANGELOG.md b/CHANGELOG.md index 78f54127008ac..ca7ad0278f0a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,8 +18,9 @@ * Misc - * Add World::create(): [#962](https://github.com/dartsim/dart/pull/962) - * Suppressed warnings: [#937](https://github.com/dartsim/dart/pull/937) + * Added World::create(): [#962](https://github.com/dartsim/dart/pull/962) + * Suppressed -Winjected-class-name warnings from Clang 5.0.0: [#964](https://github.com/dartsim/dart/pull/964) + * Suppressed -Wdangling-else warnings from GCC 7.2.0: [#937](https://github.com/dartsim/dart/pull/937) * Fixed various build issues with Visual Studio: [#956](https://github.com/dartsim/dart/pull/956) ### [DART 6.3.0 (2017-10-04)](https://github.com/dartsim/dart/milestone/36?closed=1) diff --git a/dart/common/detail/CompositeData.hpp b/dart/common/detail/CompositeData.hpp index 2a08d62307728..1805d086331fd 100644 --- a/dart/common/detail/CompositeData.hpp +++ b/dart/common/detail/CompositeData.hpp @@ -47,13 +47,38 @@ namespace dart { namespace common { namespace detail { +//============================================================================== +// This default template definition will be called when AspectOrComposite is +// an Aspect. +template +struct GetAspectImpl +{ + using Type = AspectOrComposite; +}; + +//============================================================================== +// This template specialization will be called when AspectOrComposite is not +// an Aspect (and is presumably a composite that defines a nested Aspect type). +template +struct GetAspectImpl +{ + // If you get a compiler error that leads you here, then you are trying to + // ask for the Aspect of an object that is not associated with any Aspect. + // That means it does not define a nested Aspect type (such as how + // RevoluteJoint defines the RevoluteJoint::Aspect). + // + // Whatever function is leading to the error must be given a template type + // that either defines a nested type with the name Aspect, or else inherits + // from the type dart::common::Aspect. + using Type = typename AspectOrComposite::Aspect; +}; + //============================================================================== template struct GetAspect { - using Type = typename std::conditional< - std::is_base_of::value, - AspectT, typename AspectT::Aspect>::type; + using Type = typename GetAspectImpl< + AspectT, std::is_base_of::value>::Type; }; //==============================================================================