compiler.hh (12806:d652f71ce319) | compiler.hh (12859:4f836bcde760) |
---|---|
1/* 2 * Copyright (c) 2012,2017-2018 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 78 unchanged lines hidden (view full) --- 87 88 #define M5_NODISCARD 89#endif 90 91// std::make_unique redefined for C++11 compilers 92namespace m5 93{ 94 | 1/* 2 * Copyright (c) 2012,2017-2018 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 78 unchanged lines hidden (view full) --- 87 88 #define M5_NODISCARD 89#endif 90 91// std::make_unique redefined for C++11 compilers 92namespace m5 93{ 94 |
95#if __cplusplus == 201402L // C++14 | 95#if __cplusplus >= 201402L // C++14 |
96 97using std::make_unique; 98 99#else // C++11 100 101/** Defining custom version of make_unique: m5::make_unique<>() */ 102template<typename T, typename... Args> 103std::unique_ptr<T> 104make_unique( Args&&... constructor_args ) 105{ 106 return std::unique_ptr<T>( 107 new T( std::forward<Args>(constructor_args)... ) 108 ); 109} 110 | 96 97using std::make_unique; 98 99#else // C++11 100 101/** Defining custom version of make_unique: m5::make_unique<>() */ 102template<typename T, typename... Args> 103std::unique_ptr<T> 104make_unique( Args&&... constructor_args ) 105{ 106 return std::unique_ptr<T>( 107 new T( std::forward<Args>(constructor_args)... ) 108 ); 109} 110 |
111#endif // __cplusplus == 201402L | 111#endif // __cplusplus >= 201402L |
112 113} //namespace m5 114 115#endif // __BASE_COMPILER_HH__ | 112 113} //namespace m5 114 115#endif // __BASE_COMPILER_HH__ |