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

Replace BOOST_STATIC_ASSERT with static_assert #75

Merged
merged 1 commit into from
May 31, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions include/lsst/afw/detection/FootprintArray.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@

#include "lsst/afw/detection/FootprintArray.h"
#include "lsst/afw/detection/Footprint.h"
#include <boost/static_assert.hpp>

namespace lsst{
namespace afw{
Expand Down Expand Up @@ -86,7 +85,7 @@ void flattenArray(
) {
typedef ndarray::Array<T, N, C> SourceT;
typedef ndarray::Array<U, N-1, D> DestT;
BOOST_STATIC_ASSERT(!std::is_const<U>::value);
static_assert(!std::is_const<U>::value, "destination array is not writable");

checkConvertArray(fp, dest, src, xy0);

Expand Down Expand Up @@ -114,7 +113,7 @@ void flattenArray(
) {
typedef ndarray::Array<T, N, C> SourceT;
typedef ndarray::Array<U, N-1, D> DestT;
BOOST_STATIC_ASSERT(!std::is_const<U>::value);
static_assert(!std::is_const<U>::value, "destination array is not writable");

checkConvertArray(fp, dest, src, xy0);

Expand Down Expand Up @@ -154,7 +153,7 @@ void expandArray(
{
typedef ndarray::Array<T, N, C> SourceT;
typedef ndarray::Array<U, N+1, D> DestT;
BOOST_STATIC_ASSERT(!std::is_const<U>::value);
static_assert(!std::is_const<U>::value, "destination array is not writable");

checkConvertArray(fp, src, dest, xy0);

Expand All @@ -178,7 +177,7 @@ void expandArray(
{
typedef ndarray::Array<T, N, C> SourceT;
typedef ndarray::Array<U, N+1, D> DestT;
BOOST_STATIC_ASSERT(!std::is_const<U>::value);
static_assert(!std::is_const<U>::value, "destination array is not writable");

checkConvertArray(fp, src, dest, xy0);

Expand Down
3 changes: 1 addition & 2 deletions include/lsst/afw/geom/Angle.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <iostream>
#include <boost/math/constants/constants.hpp>
#include <cmath>
#include <boost/static_assert.hpp>

namespace lsst { namespace afw { namespace geom {

Expand Down Expand Up @@ -304,7 +303,7 @@ inline
const Angle operator *(T lhs, ///< the value to convert
AngleUnit const rhs ///< the conversion coefficient
) {
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<T>::is_specialized,
static_assert(std::numeric_limits<T>::is_specialized,
"Only numeric types may be converted to Angles using degrees/radians!");
return Angle(lhs*rhs._val);
}
Expand Down
14 changes: 8 additions & 6 deletions include/lsst/afw/geom/Extent.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
#include <tuple>
#include <type_traits>

#include <boost/static_assert.hpp>

#include "lsst/pex/exceptions.h"
#include "lsst/afw/geom/CoordinateExpr.h"

Expand Down Expand Up @@ -316,7 +314,8 @@ template<typename T>
template<typename U>
Extent<T, 2>::Extent(Extent<U, 2> const & other)
{
BOOST_STATIC_ASSERT( (!std::is_same<T,U>::value && std::is_integral<U>::value) );
static_assert((!std::is_same<T,U>::value && std::is_integral<U>::value),
"can only construct from Extent of different but integral type");
this->setX(static_cast<T>(other.getX()));
this->setY(static_cast<T>(other.getY()));
};
Expand All @@ -325,7 +324,8 @@ template<typename T>
template<typename U>
Extent<T, 2>::Extent(Point<U, 2> const & other)
{
BOOST_STATIC_ASSERT( (!std::is_same<T,U>::value && std::is_integral<U>::value) );
static_assert((!std::is_same<T,U>::value && std::is_integral<U>::value),
"can only construct from Extent of different but integral type");
this->setX(static_cast<T>(other.getX()));
this->setY(static_cast<T>(other.getY()));
};
Expand All @@ -335,7 +335,8 @@ template<typename T>
template<typename U>
Extent<T, 3>::Extent(Extent<U, 3> const & other)
{
BOOST_STATIC_ASSERT( (!std::is_same<T,U>::value && std::is_integral<U>::value) );
static_assert((!std::is_same<T,U>::value && std::is_integral<U>::value),
"can only construct from Extent of different but integral type");
this->setX(static_cast<T>(other.getX()));
this->setY(static_cast<T>(other.getY()));
this->setZ(static_cast<T>(other.getZ()));
Expand All @@ -346,7 +347,8 @@ template<typename T>
template<typename U>
Extent<T, 3>::Extent(Point<U, 3> const & other)
{
BOOST_STATIC_ASSERT( (!std::is_same<T,U>::value && std::is_integral<U>::value) );
static_assert((!std::is_same<T,U>::value && std::is_integral<U>::value),
"can only construct from Extent of different but integral type");
this->setX(static_cast<T>(other.getX()));
this->setY(static_cast<T>(other.getY()));
this->setZ(static_cast<T>(other.getZ()));
Expand Down
1 change: 0 additions & 1 deletion include/lsst/afw/math/Kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include <vector>

#include "boost/mpl/or.hpp"
#include "boost/static_assert.hpp"

#include "boost/serialization/shared_ptr.hpp"
#include "boost/serialization/vector.hpp"
Expand Down
4 changes: 1 addition & 3 deletions src/geom/Angle.cc
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@

#include <iostream>

#include "boost/static_assert.hpp"

#include "lsst/afw/geom/Angle.h"

namespace lsst { namespace afw { namespace geom {

template<typename T>
double operator /(T const lhs, Angle const rhs) {
BOOST_STATIC_ASSERT_MSG((sizeof(T) == 0), "You may not divide by an Angle");
static_assert((sizeof(T) == 0), "You may not divide by an Angle");
return 0.0;
}

Expand Down