Commit 1c145395 authored by Robert Maynard's avatar Robert Maynard
Browse files

Merge branch 'correct_vtkm_pair_init' into 'master'

Properly initialize vtkm::Pair, and remove the TypeTrait for it.

vtkm::Pair can hold vtkm::Vec so we need to call the proper constructor
for vtkm::Vec.

Now that vtkm::TypeTraits don't error out on unknown types, we don't need
the weird specialization for vtkm::Pair.

See merge request !39
parents 3f60ebbd eb7e388a
......@@ -23,6 +23,7 @@
#include <vtkm/internal/Configure.h>
#include <vtkm/internal/ExportMacros.h>
#include <vtkm/TypeTraits.h>
#include <utility>
......@@ -148,6 +149,21 @@ vtkm::Pair<T1,T2> make_Pair(const T1 &firstSrc, const T2 &secondSrc)
return vtkm::Pair<T1,T2>(firstSrc, secondSrc);
}
/// Traits for Pair types.
///
template<typename T, typename U>
struct TypeTraits<vtkm::Pair<T,U> >
{
typedef TypeTraitsUnkownTag NumericTag;
typedef TypeTraitsScalarTag DimensionalityTag;
VTKM_EXEC_CONT_EXPORT
static vtkm::Pair<T,U> ZeroInitialization()
{ return vtkm::make_Pair(TypeTraits<T>::ZeroInitialization(),
TypeTraits<U>::ZeroInitialization()); }
};
} // namespace vtkm
#endif //vtk_m_Pair_h
......@@ -21,7 +21,6 @@
#define vtk_m_TypeTraits_h
#include <vtkm/Types.h>
#include <vtkm/Pair.h>
namespace vtkm {
......@@ -126,18 +125,6 @@ struct TypeTraits<vtkm::Vec<T,Size> >
{ return vtkm::Vec<T,Size>( (T()) ); }
};
/// Traits for Pair types.
///
template<typename T, typename U>
struct TypeTraits<vtkm::Pair<T,U> >
{
typedef TypeTraitsUnkownTag NumericTag;
typedef TypeTraitsScalarTag DimensionalityTag;
VTKM_EXEC_CONT_EXPORT
static vtkm::Pair<T,U> ZeroInitialization() { return vtkm::Pair<T,U>(); }
};
} // namespace vtkm
#endif //vtk_m_TypeTraits_h
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