mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-08 11:29:02 +00:00
5773ea3e13
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.
42 lines
1.3 KiB
C++
42 lines
1.3 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_is_trivially_copyable_h
|
|
#define vtk_m_std_is_trivially_copyable_h
|
|
|
|
#include <type_traits>
|
|
|
|
#if defined(VTKM_USING_GLIBCXX_4)
|
|
namespace vtkmstd
|
|
{
|
|
|
|
// GCC 4.8 and 4.9 standard library does not support std::is_trivially_copyable.
|
|
// There is no relyable way to get this information (since it has to come special from
|
|
// the compiler). For our purposes, we will report as nothing being trivially copyable,
|
|
// which causes us to call the constructors with everything. This should be fine unless
|
|
// some other part of the compiler is trying to check for trivial copies (perhaps nvcc
|
|
// on top of GCC 4.8).
|
|
template <typename>
|
|
struct is_trivially_copyable : std::false_type
|
|
{
|
|
};
|
|
|
|
} // namespace vtkmstd
|
|
|
|
#else // NOT VTKM_USING_GLIBCXX_4
|
|
namespace vtkmstd
|
|
{
|
|
|
|
using std::is_trivially_copyable;
|
|
|
|
} // namespace vtkmstd
|
|
#endif
|
|
|
|
#endif //vtk_m_std_is_trivially_copyable_h
|