//============================================================================ // 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_internal_Meta_h #define vtk_m_internal_Meta_h // This header file contains templates that are helpful with template metaprogramming. // Perhaps one day these structures can be exposed in the public interface, but the // interface is a little wonky. #include namespace vtkm { namespace internal { namespace meta { /// A simple `struct` that holds a type without having to actually make the type object. template struct Type { using type = T; }; namespace detail { template struct AndImpl : std::integral_constant { }; template struct OrImpl : std::integral_constant { }; template struct NotImpl : std::integral_constant { }; } // namespace detail /// Expects two types, both with a `value` constant static value (like a `std::integral_constant`). /// Resolves to a `std::integral_constant` where B is `T1::value && T2::value`. template using And = typename detail::AndImpl::type; /// Expects two types, both with a `value` constant static value (like a `std::integral_constant`). /// Resolves to a `std::integral_constant` where B is `T1::value || T2::value`. template using Or = typename detail::OrImpl::type; /// Expects a type with a `value` constant static value (like a std::integral_constant`). /// Resolves to a `std::integral_constant` where B is `!T::value`. template using Not = typename detail::NotImpl::type; /// A single argument template that becomes its argument. Useful for passing an identity to /// transformations. template using Identity = T; } } } // namespace vtkm::internal::meta #endif //vtk_m_internal_Meta_h