h5cpp
0.6
A modern C++ wrapper for the HDF5 C library
filesystem.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
h5cpp/core/with_boost.hpp
>
4
5
#ifdef H5CPP_WITH_BOOST
6
#include <boost/filesystem.hpp>
7
namespace
fs = boost::filesystem;
8
#else
9
10
// Check for feature test macro for <filesystem>
11
#if defined(__cpp_lib_filesystem)
12
#define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 0
13
14
// Check for feature test macro for <experimental/filesystem>
15
#elif defined(__cpp_lib_experimental_filesystem)
16
#define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 1
17
18
// Can't check if headers exist so assume experimental to be safe
19
#elif !defined(__has_include)
20
#define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 1
21
22
// Check if the header "<filesystem>" exists
23
#elif __has_include(<filesystem>)
24
25
// If we're compiling on Visual Studio and are not compiling with C++17, we need
26
// to use experimental
27
#ifdef _MSC_VER
28
29
// Check and include header that defines "_HAS_CXX17"
30
#if __has_include(<yvals_core.h>)
31
#include <yvals_core.h>
32
33
// Check for enabled C++17 support
34
#if defined(_HAS_CXX17) && _HAS_CXX17
35
// We're using C++17, so let's use the normal version
36
#define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 0
37
#endif
38
#endif
39
40
// If the marco isn't defined yet, that means any of the other VS specific
41
// checks failed, so we need to use experimental
42
#ifndef INCLUDE_STD_FILESYSTEM_EXPERIMENTAL
43
#define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 1
44
#endif
45
46
// Not on Visual Studio. Let's use the normal version
47
#else
// #ifdef _MSC_VER
48
#define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 0
49
#endif
50
51
// Check if the header "<filesystem>" exists
52
#elif __has_include(<experimental/filesystem>)
53
#define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 1
54
55
// Fail if neither header is available with a nice error message
56
#else
57
#error Could not find system header "<filesystem>"
or "<experimental/filesystem>"
58
#endif
59
60
// We previously determined that we need the experimental version
61
#if INCLUDE_STD_FILESYSTEM_EXPERIMENTAL
62
// Include it
63
#include <experimental/filesystem>
64
namespace
fs = std::experimental::filesystem;
65
66
// We have a decent compiler and can use the normal version
67
#else
68
// Include it
69
#include <filesystem>
70
namespace
fs = std::filesystem;
71
#endif
72
73
#endif
with_boost.hpp
h5cpp
src
h5cpp
core
filesystem.hpp
Generated on Wed Nov 20 2024 06:59:48 for h5cpp by
1.9.1