Commit 9eca9be7 authored by Robert Maynard's avatar Robert Maynard Committed by Kitware Robot
Browse files

Merge topic 'prefer_constexpr_over_const'

7c54125b

 Switch over from static const to static constexpr where possible.
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !1097
parents 1bd74413 7c54125b
......@@ -53,7 +53,7 @@ namespace vtkm
template <>
struct VecTraits<std::string>
{
static const vtkm::IdComponent NUM_COMPONENTS = 1;
static constexpr vtkm::IdComponent NUM_COMPONENTS = 1;
using HasMultipleComponents = vtkm::VecTraitsTagSingleComponent;
};
......
......@@ -32,7 +32,7 @@
namespace
{
static const vtkm::Id ARRAY_SIZE = 10;
static constexpr vtkm::Id ARRAY_SIZE = 10;
struct TryExecuteTestFunctor
{
......
......@@ -41,7 +41,7 @@ namespace arg
template <vtkm::IdComponent ControlSignatureIndex>
struct BasicArg : vtkm::exec::arg::ExecutionSignatureTagBase
{
static const vtkm::IdComponent INDEX = ControlSignatureIndex;
static constexpr vtkm::IdComponent INDEX = ControlSignatureIndex;
using AspectTag = vtkm::exec::arg::AspectTagDefault;
};
}
......
......@@ -44,7 +44,7 @@ struct AspectTagCellShape
///
struct CellShape : vtkm::exec::arg::ExecutionSignatureTagBase
{
static const vtkm::IdComponent INDEX = 1;
static constexpr vtkm::IdComponent INDEX = 1;
using AspectTag = vtkm::exec::arg::AspectTagCellShape;
};
......
......@@ -54,7 +54,7 @@ namespace internal
template <typename ExecutionSignatureTag>
struct ExecutionSignatureTagCheck
{
static const bool Valid =
static constexpr bool Valid =
std::is_base_of<vtkm::exec::arg::ExecutionSignatureTagBase, ExecutionSignatureTag>::value;
};
......
......@@ -50,7 +50,7 @@ struct AspectTagFromCount
///
struct FromCount : vtkm::exec::arg::ExecutionSignatureTagBase
{
static const vtkm::IdComponent INDEX = 1;
static constexpr vtkm::IdComponent INDEX = 1;
using AspectTag = vtkm::exec::arg::AspectTagFromCount;
};
......
......@@ -50,7 +50,7 @@ struct AspectTagFromIndices
///
struct FromIndices : vtkm::exec::arg::ExecutionSignatureTagBase
{
static const vtkm::IdComponent INDEX = 1;
static constexpr vtkm::IdComponent INDEX = 1;
using AspectTag = vtkm::exec::arg::AspectTagFromIndices;
};
......
......@@ -56,7 +56,7 @@ struct InputIndex : vtkm::exec::arg::ExecutionSignatureTagBase
// ControlSignature because the templating is going to grab a fetch tag
// whether we use it or not. 1 should be guaranteed to be valid since you
// need at least one argument for the input domain.
static const vtkm::IdComponent INDEX = 1;
static constexpr vtkm::IdComponent INDEX = 1;
using AspectTag = vtkm::exec::arg::AspectTagInputIndex;
};
......
......@@ -45,7 +45,7 @@ struct AspectTagOnBoundary
///
struct OnBoundary : vtkm::exec::arg::ExecutionSignatureTagBase
{
static const vtkm::IdComponent INDEX = 1;
static constexpr vtkm::IdComponent INDEX = 1;
using AspectTag = vtkm::exec::arg::AspectTagOnBoundary;
};
......
......@@ -56,7 +56,7 @@ struct OutputIndex : vtkm::exec::arg::ExecutionSignatureTagBase
// ControlSignature because the templating is going to grab a fetch tag
// whether we use it or not. 1 should be guaranteed to be valid since you
// need at least one argument for the output domain.
static const vtkm::IdComponent INDEX = 1;
static constexpr vtkm::IdComponent INDEX = 1;
using AspectTag = vtkm::exec::arg::AspectTagOutputIndex;
};
......
......@@ -55,7 +55,7 @@ struct ThreadIndices : vtkm::exec::arg::ExecutionSignatureTagBase
// ControlSignature because the templating is going to grab a fetch tag
// whether we use it or not. 1 should be guaranteed to be valid since you
// need at least one argument for the input domain.
static const vtkm::IdComponent INDEX = 1;
static constexpr vtkm::IdComponent INDEX = 1;
using AspectTag = vtkm::exec::arg::AspectTagThreadIndices;
};
......
......@@ -49,7 +49,7 @@ struct AspectTagValueCount
///
struct ValueCount : vtkm::exec::arg::ExecutionSignatureTagBase
{
static const vtkm::IdComponent INDEX = 1;
static constexpr vtkm::IdComponent INDEX = 1;
using AspectTag = vtkm::exec::arg::AspectTagValueCount;
};
......
......@@ -57,7 +57,7 @@ struct VisitIndex : vtkm::exec::arg::ExecutionSignatureTagBase
// ControlSignature because the templating is going to grab a fetch tag
// whether we use it or not. 1 should be guaranteed to be valid since you
// need at least one argument for the input domain.
static const vtkm::IdComponent INDEX = 1;
static constexpr vtkm::IdComponent INDEX = 1;
using AspectTag = vtkm::exec::arg::AspectTagVisitIndex;
};
......
......@@ -53,7 +53,7 @@ struct WorkIndex : vtkm::exec::arg::ExecutionSignatureTagBase
// ControlSignature because the templating is going to grab a fetch tag
// whether we use it or not. 1 should be guaranteed to be valid since you
// need at least one argument for the input domain.
static const vtkm::IdComponent INDEX = 1;
static constexpr vtkm::IdComponent INDEX = 1;
using AspectTag = vtkm::exec::arg::AspectTagWorkIndex;
};
......
......@@ -27,7 +27,7 @@
namespace
{
static const vtkm::Id ARRAY_SIZE = 10;
static constexpr vtkm::Id ARRAY_SIZE = 10;
template <typename T>
struct TestPortal
......
......@@ -27,7 +27,7 @@
namespace
{
static const vtkm::Id ARRAY_SIZE = 10;
static constexpr vtkm::Id ARRAY_SIZE = 10;
static vtkm::Id g_NumSets;
......
......@@ -27,7 +27,7 @@
namespace
{
static const vtkm::Id ARRAY_SIZE = 10;
static constexpr vtkm::Id ARRAY_SIZE = 10;
static vtkm::Id g_NumSets;
......
......@@ -30,7 +30,7 @@
namespace
{
static const vtkm::Id ARRAY_SIZE = 10;
static constexpr vtkm::Id ARRAY_SIZE = 10;
template <typename T>
struct TestPortal
......
......@@ -99,7 +99,7 @@ template <> struct UseMultipleScalarTextureLoads<const vtkm::Vec<vtkm::Float64,
template <typename T, typename Enable = void>
struct load_through_texture
{
static const vtkm::IdComponent WillUseTexture = 0;
static constexpr vtkm::IdComponent WillUseTexture = 0;
__device__ static T get(const T* const data) { return *data; }
};
......@@ -111,7 +111,7 @@ template <typename T>
struct load_through_texture<T, typename std::enable_if<UseScalarTextureLoad<const T>::value>::type>
{
static const vtkm::IdComponent WillUseTexture = 1;
static constexpr vtkm::IdComponent WillUseTexture = 1;
__device__ static T get(const T* const data)
{
......@@ -128,7 +128,7 @@ struct load_through_texture<T, typename std::enable_if<UseScalarTextureLoad<cons
template <typename T>
struct load_through_texture<T, typename std::enable_if<UseVecTextureLoads<const T>::value>::type>
{
static const vtkm::IdComponent WillUseTexture = 1;
static constexpr vtkm::IdComponent WillUseTexture = 1;
__device__ static T get(const T* const data)
{
......@@ -189,7 +189,7 @@ struct load_through_texture<
T,
typename std::enable_if<UseMultipleScalarTextureLoads<const T>::value>::type>
{
static const vtkm::IdComponent WillUseTexture = 1;
static constexpr vtkm::IdComponent WillUseTexture = 1;
using NonConstT = typename std::remove_const<T>::type;
......
......@@ -66,7 +66,7 @@ struct InvocationToFetch
// Expected fields from ExecutionSignatureTag. If these do not exist in
// ExecutionSignatureTag, then something that is not really an execution
// signature tag was used in an ExecutionSignature.
static const vtkm::IdComponent ControlParameterIndex = ExecutionSignatureTag::INDEX;
static constexpr vtkm::IdComponent ControlParameterIndex = ExecutionSignatureTag::INDEX;
using AspectTag = typename ExecutionSignatureTag::AspectTag;
// Find the fetch tag from the control signature tag pointed to by
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment