Skip to content

Commit

Permalink
Added definitions for constexpr static members (see #603)
Browse files Browse the repository at this point in the history
  • Loading branch information
jslee02 committed Aug 5, 2017
1 parent 0a668d9 commit 8f4b790
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
57 changes: 57 additions & 0 deletions dart/math/ConfigurationSpace.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright (c) 2017, Graphics Lab, Georgia Tech Research Corporation
* Copyright (c) 2017, Personal Robotics Lab, Carnegie Mellon University
* All rights reserved.
*
* This file is provided under the following "BSD-style" License:
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "dart/math/ConfigurationSpace.hpp"

namespace dart {
namespace math {

//==============================================================================
//
// 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
//
constexpr std::size_t SO3Space::NumDofs;
constexpr int SO3Space::NumDofsEigen;

//==============================================================================
//
// 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
//
constexpr std::size_t SE3Space::NumDofs;
constexpr int SE3Space::NumDofsEigen;

} // namespace math
} // namespace dart
13 changes: 12 additions & 1 deletion dart/math/ConfigurationSpace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ struct RealVectorSpace
using JacobianMatrix = Eigen::Matrix<double, 6, NumDofs>;
};

//==============================================================================
//
// 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 <std::size_t Dimension>
constexpr std::size_t RealVectorSpace<Dimension>::NumDofs;
template <std::size_t Dimension>
constexpr int RealVectorSpace<Dimension>::NumDofsEigen;

using NullSpace = RealVectorSpace<0u>;
using R1Space = RealVectorSpace<1u>;
using R2Space = RealVectorSpace<2u>;
Expand Down Expand Up @@ -92,7 +104,6 @@ struct SE3Space

struct MapsToManifoldPoint {};


//==============================================================================
template <typename SpaceT>
typename SpaceT::Matrix inverse(const typename SpaceT::Matrix& mat);
Expand Down

0 comments on commit 8f4b790

Please sign in to comment.