mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-04 22:49:07 +02:00
define freer
This commit is contained in:
parent
1eff721f09
commit
5ca8766c52
@ -750,6 +750,23 @@ make_movable_with_deleter(const Deleter &d, Args&&... args)
|
|||||||
return movable_ptr_with_deleter<T, Deleter>(safenew T(std::forward<Args>(args)...), d);
|
return movable_ptr_with_deleter<T, Deleter>(safenew T(std::forward<Args>(args)...), d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A deleter for pointers obtained with malloc
|
||||||
|
*/
|
||||||
|
struct freer { void operator() (void *p) const { free(p); } };
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A useful alias for holding the result of malloc
|
||||||
|
*/
|
||||||
|
template< typename T >
|
||||||
|
using MallocPtr = std::unique_ptr< T, freer >;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A useful alias for holding the result of strup and similar
|
||||||
|
*/
|
||||||
|
template <typename Character = char>
|
||||||
|
using MallocString = std::unique_ptr< Character[], freer >;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A deleter class to supply the second template parameter of unique_ptr for
|
* A deleter class to supply the second template parameter of unique_ptr for
|
||||||
* classes like wxWindow that should be sent a message called Destroy rather
|
* classes like wxWindow that should be sent a message called Destroy rather
|
||||||
|
Loading…
x
Reference in New Issue
Block a user