//============================================================================ // Copyright (c) Kitware, Inc. // All rights reserved. // See LICENSE.txt for details. // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notice for more information. //============================================================================ #ifndef vtk_m_List_h #define vtk_m_List_h #include #include namespace vtkm { template struct List { }; namespace detail { // This prototype is here to detect deprecated ListTag objects. When ListTags are removed, then // this should be removed too. struct ListRoot; } namespace internal { template struct IsListImpl { // This prototype is here to detect deprecated ListTag objects. When ListTags are removed, then // this should be changed to be just std::false_type. using type = std::is_base_of; }; template struct IsListImpl> { using type = std::true_type; }; template using IsList = typename vtkm::internal::IsListImpl::type; } // namespace internal /// Checks that the argument is a proper list. This is a handy concept /// check for functions and classes to make sure that a template argument is /// actually a device adapter tag. (You can get weird errors elsewhere in the /// code when a mistake is made.) /// #define VTKM_IS_LIST(type) \ VTKM_STATIC_ASSERT_MSG((::vtkm::internal::IsList::value), \ "Provided type is not a valid VTK-m list type.") namespace detail { /// list value that is used to represent a list actually matches all values struct UniversalTypeTag { //We never want this tag constructed, and by deleting the constructor //we get an error when trying to use this class with ForEach. UniversalTypeTag() = delete; }; } // namespace detail namespace internal { // This is here so that the old (deprecated) `ListTag`s can convert themselves to the new // `List` style and be operated on. When that deprecated functionality goes away, we can // probably remove `AsList` and just operate directly on the `List`s. template struct AsListImpl; template struct AsListImpl> { using type = vtkm::List; }; template using AsList = typename AsListImpl::type; } /// A special tag for an empty list. /// using ListEmpty = vtkm::List<>; /// A special tag for a list that represents holding all potential values /// /// Note: Can not be used with ForEach and some list transforms for obvious reasons. using ListUniversal = vtkm::List; namespace detail { template class Target> struct ListApplyImpl; template class Target> struct ListApplyImpl, Target> { using type = Target; }; // Cannot apply the universal list. template