Commit 12810165 authored by Robert Maynard's avatar Robert Maynard
Browse files

Switch over to c++11 type_traits.

parent 696ca48b
......@@ -23,10 +23,6 @@
#include <vtkm/StaticAssert.h>
#include <vtkm/Types.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/type_traits/integral_constant.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
namespace vtkm {
/// CellShapeId identifies the type of each cell. Currently these are designed
......@@ -63,10 +59,10 @@ enum CellShapeIdEnum
namespace internal {
/// A class that can be used to determine if a class is a CellShapeTag or not.
/// The class will be either boost::true_type or boost::false_type.
/// The class will be either std::true_type or std::false_type.
///
template<typename T>
struct CellShapeTagCheck : boost::false_type { };
struct CellShapeTagCheck : std::false_type { };
} // namespace internal
......@@ -87,7 +83,7 @@ struct CellShapeIdToTag {
// probably means you are using an ID that does not have a defined cell
// shape.
typedef boost::false_type valid;
typedef std::false_type valid;
};
......@@ -100,7 +96,7 @@ struct CellShapeIdToTag {
}; \
namespace internal { \
template<> \
struct CellShapeTagCheck<vtkm::CellShapeTag ## name> : boost::true_type { }; \
struct CellShapeTagCheck<vtkm::CellShapeTag ## name> : std::true_type { }; \
} \
VTKM_EXEC_CONT_EXPORT \
const char *GetCellShapeName(vtkm::CellShapeTag ## name) { \
......@@ -108,7 +104,7 @@ struct CellShapeIdToTag {
} \
template<> \
struct CellShapeIdToTag<vtkm::idname> { \
typedef boost::true_type valid; \
typedef std::true_type valid; \
typedef vtkm::CellShapeTag ## name Tag; \
}
......
......@@ -25,9 +25,7 @@
#include <vtkm/StaticAssert.h>
#include <vtkm/internal/ExportMacros.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/type_traits/is_base_of.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
#include <type_traits>
namespace vtkm {
......@@ -36,8 +34,8 @@ namespace internal {
template<typename ListTag>
struct ListTagCheck
{
static const bool Valid =
boost::is_base_of<vtkm::detail::ListRoot,ListTag>::value;
static VTKM_CONSTEXPR bool Valid = std::is_base_of<vtkm::detail::ListRoot,
ListTag>::value;
};
} // namespace internal
......
......@@ -22,10 +22,6 @@
#include <vtkm/Types.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/mpl/assert.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
namespace vtkm {
/// \brief A tag used to identify the cell elements in a topology.
......@@ -63,44 +59,41 @@ struct TopologyElementTagFace { };
namespace internal {
/// Checks to see if the given object is a topology element tag. This check is
/// compatible with the Boost meta-template programing library (MPL). It
/// contains a typedef named \c type that is either boost::mpl::true_ or
/// boost::mpl::false_. Both of these have a typedef named value with the
/// Checks to see if the given object is a topology element tag.This check is
/// compatible with C++11 type_traits.
/// It contains a typedef named \c type that is either std::true_type or
/// std::false_type. Both of these have a typedef named value with the
/// respective boolean value.
///
template<typename T>
struct TopologyElementTagCheck
struct TopologyElementTagCheck : std::false_type
{
typedef boost::mpl::false_ type;
};
template<>
struct TopologyElementTagCheck<vtkm::TopologyElementTagCell>
struct TopologyElementTagCheck<vtkm::TopologyElementTagCell> : std::true_type
{
typedef boost::mpl::true_ type;
};
template<>
struct TopologyElementTagCheck<vtkm::TopologyElementTagPoint>
struct TopologyElementTagCheck<vtkm::TopologyElementTagPoint> : std::true_type
{
typedef boost::mpl::true_ type;
};
template<>
struct TopologyElementTagCheck<vtkm::TopologyElementTagEdge>
struct TopologyElementTagCheck<vtkm::TopologyElementTagEdge> : std::true_type
{
typedef boost::mpl::true_ type;
};
template<>
struct TopologyElementTagCheck<vtkm::TopologyElementTagFace>
struct TopologyElementTagCheck<vtkm::TopologyElementTagFace> : std::true_type
{
typedef boost::mpl::true_ type;
};
#define VTKM_IS_TOPOLOGY_ELEMENT_TAG(type) \
BOOST_MPL_ASSERT(( ::vtkm::internal::TopologyElementTagCheck<type> ))
static_assert( ::vtkm::internal::TopologyElementTagCheck<type>::value, \
"Invalid Topology Element Tag being used");
} // namespace internal
......
......@@ -20,20 +20,13 @@
#ifndef vtk_m_Types_h
#define vtk_m_Types_h
#include <vtkm/internal/Configure.h>
#include <vtkm/internal/ExportMacros.h>
#include <vtkm/Assert.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/mpl/or.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/type_traits/is_signed.hpp>
#include <boost/utility/enable_if.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
#include <iostream>
#include <type_traits>
/*!
* \namespace vtkm
......@@ -1270,16 +1263,15 @@ operator/(const vtkm::Vec<vtkm::Float64, Size> &vec, vtkm::Float64 scalar)
}
// The enable_if for this operator is effectively disabling the negate
// operator for Vec of unsigned integers. Another approach would be
// to use disable_if<is_unsigned>. That would be more inclusive but would
// to use enable_if<!is_unsigned>. That would be more inclusive but would
// also allow other types like Vec<Vec<unsigned> >. If necessary, we could
// change this implementation to be more inclusive.
template<typename T, vtkm::IdComponent Size>
VTKM_EXEC_CONT_EXPORT
typename boost::enable_if<
typename boost::mpl::or_<
typename boost::is_floating_point<T>::type,
typename boost::is_signed<T>::type>::type,
vtkm::Vec<T,Size> >::type
typename std::enable_if<
(std::is_floating_point<T>::value || std::is_signed<T>::value),
vtkm::Vec<T,Size>
>::type
operator-(const vtkm::Vec<T,Size> &x)
{
return vtkm::internal::VecComponentWiseUnaryOperation<Size>()(
......
......@@ -22,10 +22,6 @@
#include <vtkm/Types.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/type_traits/remove_const.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
namespace vtkm {
/// A tag for vectors that are "true" vectors (i.e. have more than one
......@@ -103,10 +99,10 @@ struct VecTraits
/// Returns the value in a given component of the vector.
///
VTKM_EXEC_CONT_EXPORT static const ComponentType &GetComponent(
const typename boost::remove_const<VecType>::type &vector,
const typename std::remove_const<VecType>::type &vector,
vtkm::IdComponent component);
VTKM_EXEC_CONT_EXPORT static ComponentType &GetComponent(
typename boost::remove_const<VecType>::type &vector,
typename std::remove_const<VecType>::type &vector,
vtkm::IdComponent component);
/// Changes the value in a given component of the vector.
......
......@@ -34,10 +34,8 @@
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/concept_check.hpp>
#include <boost/mpl/not.hpp>
#include <boost/smart_ptr/scoped_ptr.hpp>
#include <boost/smart_ptr/shared_ptr.hpp>
#include <boost/type_traits/is_base_of.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
#include <vector>
......@@ -56,48 +54,48 @@ namespace internal {
class ArrayHandleBase { };
/// Checks to see if the given type and storage can form a valid array handle
/// (some storage objects cannot support all types). This check is compatable
/// with the Boost meta-template programming library (MPL). It contains a
/// typedef named type that is either boost::mpl::true_ or boost::mpl::false_.
/// (some storage objects cannot support all types). This check is compatible
/// with C++11 type_traits. It contains a
/// typedef named type that is either std::true_type or std::false_type.
/// Both of these have a typedef named value with the respective boolean value.
///
template<typename T, typename StorageTag>
struct IsValidArrayHandle {
typedef typename boost::mpl::not_<
typename boost::is_base_of<
vtkm::cont::internal::UndefinedStorage,
vtkm::cont::internal::Storage<T,StorageTag>
>::type
>::type type;
//need to add the not
using type = std::integral_constant<bool,
!( std::is_base_of<
vtkm::cont::internal::UndefinedStorage,
vtkm::cont::internal::Storage<T,StorageTag>
>::value)>;
};
/// Checks to see if the ArrayHandle for the given DeviceAdatper allows
/// writing, as some ArrayHandles (Implicit) don't support writing.
/// This check is compatable with the Boost meta-template programming
/// library (MPL). It contains a typedef named type that is either
// boost::mpl::true_ or boost::mpl::false_.
/// This check is compatible with the C++11 type_traits.
/// It contains a typedef named type that is either
/// std::true_type or std::false_type.
/// Both of these have a typedef named value with the respective boolean value.
///
template<typename ArrayHandle, typename DeviceAdapterTag>
struct IsWriteableArrayHandle {
private:
typedef typename ArrayHandle:: template ExecutionTypes<
DeviceAdapterTag > ExecutionTypes;
typedef typename ExecutionTypes::Portal::ValueType ValueType;
template<typename T>
using ExecutionTypes = typename ArrayHandle::template ExecutionTypes<T>;
using ValueType = typename ExecutionTypes<DeviceAdapterTag>::Portal::ValueType;
//All ArrayHandles that use ImplicitStorage as the final writable location
//will have a value type of void*, which is what we are trying to detect
typedef typename boost::remove_pointer<ValueType>::type RawValueType;
typedef boost::is_void<RawValueType> IsVoidType;
using RawValueType = typename std::remove_pointer<ValueType>::type;
using IsVoidType = std::is_void<RawValueType>;
public:
typedef typename boost::mpl::not_<IsVoidType>::type type;
using type = std::integral_constant<bool, !IsVoidType::value>;
};
/// Checks to see if the given object is an array handle. This check is
/// compatible with the Boost meta-template programming library (MPL). It
/// contains a typedef named \c type that is either boost::mpl::true_ or
/// boost::mpl::false_. Both of these have a typedef named value with the
/// respective boolean value.
/// compatible with C++11 type_traits. It a typedef named \c type that is
/// either std::true_type or std::false_type. Both of these have a typedef
/// named value with the respective boolean value.
///
/// Unlike \c IsValidArrayHandle, if an \c ArrayHandle is used with this
/// class, then it must be created by the compiler and therefore must already
......@@ -109,8 +107,8 @@ public:
template<typename T>
struct ArrayHandleCheck
{
typedef typename boost::is_base_of<
::vtkm::cont::internal::ArrayHandleBase, T>::type type;
using type = typename std::is_base_of<
::vtkm::cont::internal::ArrayHandleBase, T>::type;
};
#define VTKM_IS_ARRAY_HANDLE(T) \
......
......@@ -24,10 +24,6 @@
#include <vtkm/cont/ArrayPortal.h>
#include <vtkm/cont/ErrorControlBadValue.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/type_traits/remove_const.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
namespace vtkm {
namespace exec {
......@@ -41,7 +37,7 @@ public:
typedef _SourcePortalType SourcePortalType;
typedef typename
boost::remove_const<typename SourcePortalType::ValueType>::type
std::remove_const<typename SourcePortalType::ValueType>::type
ComponentType;
typedef vtkm::Vec<ComponentType, NUM_COMPONENTS> ValueType;
......
......@@ -28,10 +28,6 @@
#include <vtkm/cont/DynamicArrayHandle.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/type_traits/is_base_of.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
namespace vtkm {
namespace cont {
......@@ -90,16 +86,15 @@ protected:
namespace internal {
/// Checks to see if the given object is a cell set. This check is compatible
/// with the Boost meta-template programming library (MPL). It contains a
/// typedef named \c type that is either boost::mpl::true_ or
/// boost::mpl::false_. Both of these have a typedef named value with the
/// Checks to see if the given object is a cell set. It contains a
/// typedef named \c type that is either std::true_type or
/// std::false_type. Both of these have a typedef named value with the
/// respective boolean value.
///
template<typename T>
struct CellSetCheck
{
typedef typename boost::is_base_of<vtkm::cont::CellSet, T>::type type;
using type = typename std::is_base_of<vtkm::cont::CellSet, T>;
};
#define VTKM_IS_CELL_SET(T) \
......
......@@ -442,7 +442,7 @@ struct DynamicArrayHandleTryStorage {
private:
template<typename Storage>
void DoCast(Storage, boost::mpl::bool_<true>)
void DoCast(Storage, std::true_type)
{
if (!this->FoundCast &&
this->Array->template IsTypeAndStorage<Type,Storage>())
......@@ -453,7 +453,7 @@ private:
}
template<typename Storage>
void DoCast(Storage, boost::mpl::bool_<false>)
void DoCast(Storage, std::false_type)
{
// This type of array handle cannot exist, so do nothing.
}
......
......@@ -23,9 +23,7 @@
#include <vtkm/StaticAssert.h>
#include <vtkm/internal/ExportMacros.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/type_traits/is_base_of.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
#include <type_traits>
namespace vtkm {
namespace cont {
......@@ -49,8 +47,8 @@ namespace internal {
template<typename ControlSignatureTag>
struct ControlSignatureTagCheck
{
static const bool Valid =
boost::is_base_of<
static VTKM_CONSTEXPR bool Valid =
std::is_base_of<
vtkm::cont::arg::ControlSignatureTagBase, ControlSignatureTag>::value;
};
......
......@@ -26,11 +26,6 @@
#include <vtkm/exec/ExecutionObjectBase.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_base_of.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
namespace vtkm {
namespace cont {
namespace arg {
......@@ -49,7 +44,9 @@ struct Transport<vtkm::cont::arg::TransportTagExecObject,ContObjectType,Device>
// is not an execution object as an argument that is expected to be one. All
// execution objects are expected to inherit from
// vtkm::exec::ExecutionObjectBase.
BOOST_MPL_ASSERT(( boost::is_base_of<vtkm::exec::ExecutionObjectBase, ContObjectType> ));
static_assert(
std::is_base_of<vtkm::exec::ExecutionObjectBase, ContObjectType>::value,
"All execution objects are expected to inherit from vtkm::exec::ExecutionObjectBase");
typedef ContObjectType ExecObjectType;
......
......@@ -26,9 +26,7 @@
#include <vtkm/exec/ExecutionObjectBase.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/type_traits/is_base_of.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
#include <type_traits>
namespace vtkm {
namespace cont {
......@@ -43,8 +41,8 @@ struct TypeCheckTagExecObject { };
template<typename Type>
struct TypeCheck<TypeCheckTagExecObject, Type>
{
static const bool value =
boost::is_base_of<vtkm::exec::ExecutionObjectBase, Type>::value;
static VTKM_CONSTEXPR bool value =
std::is_base_of<vtkm::exec::ExecutionObjectBase, Type>::value;
};
}
......
......@@ -29,7 +29,7 @@
#include <iterator>
#include <limits>
#include <boost/type_traits.hpp>
#include <type_traits>
namespace vtkm {
namespace cont {
......@@ -43,8 +43,8 @@ class ArrayPortalFromIterators;
///
template<class IteratorT>
class ArrayPortalFromIterators<IteratorT,
typename boost::disable_if<
boost::is_const< typename boost::remove_pointer<IteratorT>::type > >::type>
typename std::enable_if<
!std::is_const< typename std::remove_pointer<IteratorT>::type >::value >::type >
{
public:
typedef typename std::iterator_traits<IteratorT>::value_type ValueType;
......@@ -127,8 +127,8 @@ private:
template<class IteratorT>
class ArrayPortalFromIterators<IteratorT,
typename boost::enable_if<
boost::is_const< typename boost::remove_pointer<IteratorT>::type > >::type>
typename std::enable_if<
std::is_const< typename std::remove_pointer<IteratorT>::type >::value >::type >
{
public:
typedef typename std::iterator_traits<IteratorT>::value_type ValueType;
......
......@@ -35,7 +35,7 @@ template<typename NumIndicesArrayType,
void buildIndexOffsets(const NumIndicesArrayType& numIndices,
IndexOffsetArrayType& offsets,
DeviceAdapterTag,
boost::mpl::bool_<true>)
std::true_type)
{
//We first need to make sure that NumIndices and IndexOffsetArrayType
//have the same type so we can call scane exclusive
......@@ -55,7 +55,7 @@ template<typename NumIndicesArrayType,
void buildIndexOffsets(const NumIndicesArrayType&,
IndexOffsetArrayType&,
DeviceAdapterTag,
boost::mpl::bool_<false>)
std::false_type)
{
//this is a no-op as the storage for the offsets is an implicit handle
//and should already be built. This signature exists so that
......
......@@ -32,11 +32,6 @@
#include <vtkm/exec/internal/ErrorMessageBuffer.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/iterator/counting_iterator.hpp>
#include <boost/utility/enable_if.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
#include <algorithm>
#include <numeric>
......
......@@ -213,7 +213,7 @@ namespace boost {
/// boost::is_reference type check to declare our value class as a reference
/// type. Even though it is not a true reference type, its operators make it
/// behave like one.
///
///
template<typename T>
struct is_reference<
vtkm::cont::internal::detail::IteratorFromArrayPortalValue<T> >
......
......@@ -23,10 +23,6 @@
#include <vtkm/StaticAssert.h>
#include <vtkm/Types.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/type_traits/is_base_of.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
/// Checks that the argument is a proper \c PointCoordinates class. This is a
/// handy concept check for functions and classes to make sure that a template
/// argument is actually point coordinates. (You can get weird errors elsewhere
......@@ -61,15 +57,14 @@ public:
virtual ~PointCoordinatesBase() { }
};
/// Checks to see if the given type is a valid point coordinates class. This
/// check is compatable with the Boost meta-template programming library (MPL).
/// It contains a typedef named type that is either boost::mpl::true_ or
/// boost::mpl::false_. Both of these have a typedef named value with the
/// Checks to see if the given type is a valid point coordinates class.
/// It contains a typedef named type that is either std::true_type or
/// std::false_type. Both of these have a typedef named value with the
/// respective boolean value.
///
template<typename Type>
struct IsValidPointCoordinates {
typedef typename boost::is_base_of<
typedef typename std::is_base_of<
vtkm::cont::internal::PointCoordinatesBase,Type>::type type;
};
......
......@@ -29,8 +29,6 @@
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/type_traits/remove_reference.hpp>
// gcc || clang
#if defined(_WIN32)
// TBB includes windows.h, which clobbers min and max functions so we
......@@ -77,8 +75,8 @@ template<class InputPortalType, class OutputPortalType,
class BinaryOperationType>
struct ScanInclusiveBody
{
typedef typename boost::remove_reference<
typename OutputPortalType::ValueType>::type ValueType;
using ValueType = typename std::remove_reference<
typename OutputPortalType::ValueType>::type;
ValueType Sum;
bool FirstCall;
InputPortalType InputPortal;
......@@ -175,8 +173,9 @@ template<class InputPortalType, class OutputPortalType,
class BinaryOperationType>
struct ScanExclusiveBody
{
typedef typename boost::remove_reference<
typename OutputPortalType::ValueType>::type ValueType;
using ValueType = typename std::remove_reference<
typename OutputPortalType::ValueType>::type;
ValueType Sum;
ValueType InitialValue;
InputPortalType InputPortal;
......@@ -272,14 +271,14 @@ template<class InputPortalType, class OutputPortalType,
class BinaryOperationType>
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_CONT_EXPORT static
typename boost::remove_reference<typename OutputPortalType::ValueType>::type
typename std::remove_reference<typename OutputPortalType::ValueType>::type
ScanInclusivePortals(InputPortalType inputPortal,
OutputPortalType outputPortal,
BinaryOperationType binaryOperation)
{
typedef typename
boost::remove_reference<typename OutputPortalType::ValueType>::type
ValueType;
using ValueType = typename std::remove_reference<
typename OutputPortalType::ValueType>::type;
typedef internal::WrappedBinaryOperator<ValueType, BinaryOperationType>
WrappedBinaryOp;
......@@ -297,16 +296,16 @@ template<class InputPortalType, class OutputPortalType,
class BinaryOperationType>
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_CONT_EXPORT static
typename boost::remove_reference<typename OutputPortalType::ValueType>::type
typename std::remove_reference<typename OutputPortalType::ValueType>::type
ScanExclusivePortals(InputPortalType inputPortal,
OutputPortalType outputPortal,
BinaryOperationType binaryOperation,
typename boost::remove_reference<
typename std::remove_reference<
typename OutputPortalType::ValueType>::type initialValue)
{
typedef typename
boost::remove_reference<typename OutputPortalType::ValueType>::type
ValueType;
using ValueType = typename std::remove_reference<
typename OutputPortalType::ValueType>::type;
typedef internal::WrappedBinaryOperator<ValueType, BinaryOperationType>
WrappedBinaryOp;
......
......@@ -29,7 +29,6 @@
#include <vtkm/cont/DeviceAdapterSerial.h>
#include <vtkm/cont/testing/Testing.h>