Remove Set method from const ArrayPortalFromIterators specialization...
...and add unit test. Related to !2071, #502.
This commit is contained in:
parent
de74a96195
commit
2d4d54b170
@ -172,15 +172,6 @@ public:
|
||||
VTKM_EXEC_CONT
|
||||
ValueType Get(vtkm::Id index) const { return *this->IteratorAt(index); }
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT
|
||||
void Set(vtkm::Id vtkmNotUsed(index), const ValueType& vtkmNotUsed(value)) const
|
||||
{
|
||||
#if !(defined(VTKM_MSVC) && defined(VTKM_CUDA))
|
||||
VTKM_ASSERT(false && "Attempted to write to constant array.");
|
||||
#endif
|
||||
}
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT
|
||||
IteratorT GetIteratorBegin() const { return this->BeginIterator; }
|
||||
|
@ -73,6 +73,19 @@ struct TemplatedTests
|
||||
::vtkm::cont::internal::ArrayPortalFromIterators<const ValueType*> const_portal(
|
||||
array, array + ARRAY_SIZE);
|
||||
|
||||
using PortalType = decltype(portal);
|
||||
using PortalConstType = decltype(const_portal);
|
||||
|
||||
std::cout << "Check that PortalSupports* results are valid:" << std::endl;
|
||||
VTKM_TEST_ASSERT(vtkm::internal::PortalSupportsSets<PortalType>::value,
|
||||
"Writable portals should support Set operations");
|
||||
VTKM_TEST_ASSERT(vtkm::internal::PortalSupportsGets<PortalType>::value,
|
||||
"Writable portals should support Get operations");
|
||||
VTKM_TEST_ASSERT(!vtkm::internal::PortalSupportsSets<PortalConstType>::value,
|
||||
"Read-only portals should not allow Set operations");
|
||||
VTKM_TEST_ASSERT(vtkm::internal::PortalSupportsGets<PortalConstType>::value,
|
||||
"Read-only portals should support Get operations");
|
||||
|
||||
std::cout << " Check that ArrayPortalToIterators is not doing indirection." << std::endl;
|
||||
// If you get a compile error here about mismatched types, it might be
|
||||
// that ArrayPortalToIterators is not properly overloaded to return the
|
||||
|
Loading…
Reference in New Issue
Block a user