mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-08 16:39:59 +02:00
Do that again without macros... I don't like macros if I can avoid 'em.
This commit is contained in:
parent
de75a00c10
commit
3c57e1fc0c
@ -485,15 +485,21 @@ static char*THIS_FILE = __FILE__;
|
|||||||
// to shared_ptr if we can't (because containers know how to copy elements only,
|
// to shared_ptr if we can't (because containers know how to copy elements only,
|
||||||
// not move them).
|
// not move them).
|
||||||
#ifdef __AUDACITY_OLD_STD__
|
#ifdef __AUDACITY_OLD_STD__
|
||||||
|
|
||||||
template<typename T> using movable_ptr = std::shared_ptr<T>;
|
template<typename T> using movable_ptr = std::shared_ptr<T>;
|
||||||
#define make_movable std::make_shared
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
template<typename T> using movable_ptr = std::unique_ptr<T>;
|
template<typename T> using movable_ptr = std::unique_ptr<T>;
|
||||||
#define make_movable std::make_unique
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
template<typename T, typename... Args>
|
||||||
|
inline movable_ptr<T> make_movable(Args&&... args)
|
||||||
|
{
|
||||||
|
return std::
|
||||||
|
#ifdef __AUDACITY_OLD_STD__
|
||||||
|
make_shared
|
||||||
|
#else
|
||||||
|
make_unique
|
||||||
|
#endif
|
||||||
|
<T>(std::forward<Args>(args)...);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // __AUDACITY_MEMORY_X_H__
|
#endif // __AUDACITY_MEMORY_X_H__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user