-
Notifications
You must be signed in to change notification settings - Fork 46
/
chef_env.hpp
61 lines (49 loc) · 1.64 KB
/
chef_env.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright 2022, Yoko. All rights reserved.
//
// Author: Yoko (191201771@qq.com)
// c++11和libboost功能相同部分的wrapper
// 通过增加一层接入层,使上层代码仅需通过一个宏开关就可以自由切换使用c++11或libboost
#ifndef CHEF_BASE_ENV_HPP_
#define CHEF_BASE_ENV_HPP_
#pragma once
// #define CHEF_USE_BOOST
#ifndef CHEF_USE_BOOST
#if (__cplusplus < 201103L)
#error("some of chef_env stuff deps on c++11 or boost, you should compile it with c++11 support or define macro CHEF_USE_BOOST if you choose to use boost instead.")
#endif
#endif
#ifdef CHEF_USE_BOOST
#include <boost/thread.hpp>
#include <boost/atomic.hpp>
#include <boost/smart_ptr.hpp>
#include <boost/functional.hpp>
#include <boost/chrono.hpp>
namespace chef_env_keeper = boost;
#else
#include <mutex>
#include <thread>
#include <condition_variable>
#include <atomic>
#include <memory>
#include <functional>
#include <chrono>
namespace chef_env_keeper = std;
#endif
namespace chef {
using chef_env_keeper::thread;
using chef_env_keeper::mutex;
using chef_env_keeper::recursive_mutex;
using chef_env_keeper::lock_guard;
using chef_env_keeper::unique_lock;
using chef_env_keeper::condition_variable;
typedef chef_env_keeper::cv_status cv_status;
namespace this_thread = chef_env_keeper::this_thread;
using chef_env_keeper::atomic;
using chef_env_keeper::shared_ptr;
using chef_env_keeper::make_shared;
using chef_env_keeper::enable_shared_from_this;
using chef_env_keeper::bind;
using chef_env_keeper::function;
namespace chrono = chef_env_keeper::chrono;
} // namespace chef
#endif /// CHEF_BASE_ENV_HPP_