mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Currently, VTK-m is using C++11. However, it is often useful to use features in the `std` namespace that are defined for C++14 or later. We can provide our own versions (sometimes), but it is preferable to use the version provided by the compiler if available. There were already some examples of defining portable versions of C++14 and C++17 classes in a `vtkmstd` namespace, but these were sprinkled around the source code. There is now a top level `vtkmstd` directory and in it are header files that provide portable versions of these future C++ classes. In each case, preprocessor macros are used to select which version of the class to use.
41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
//============================================================================
|
|
// 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_std_void_t_h
|
|
#define vtk_m_std_void_t_h
|
|
|
|
#include <vtkm/internal/Configure.h>
|
|
|
|
namespace vtkmstd
|
|
{
|
|
|
|
/// Implementation of std::void_t (C++17):
|
|
/// Allows for specialization of class templates based on members of template
|
|
/// parameters.
|
|
#if defined(VTKM_GCC) && (__GNUC__ < 5)
|
|
// Due to a defect in the wording (CWG 1558) unused parameters in alias templates
|
|
// were not guaranteed to ensure SFINAE, and therefore would consider everything
|
|
// to match the 'true' side. For VTK-m the only known compiler that implemented
|
|
// this defect is GCC < 5.
|
|
template <class... T>
|
|
struct void_pack
|
|
{
|
|
using type = void;
|
|
};
|
|
template <class... T>
|
|
using void_t = typename void_pack<T...>::type;
|
|
#else
|
|
template <typename...>
|
|
using void_t = void;
|
|
#endif
|
|
|
|
} // end namespace vtkmstd
|
|
|
|
#endif //vtk_m_std_void_t_h
|