Any developers working in this area ?
I’m a little stuck on Audacity/MemoryX.h
… Too many errors emitted, stopping
Things are looking good for all the other project parts, except for this main ? part - Audacity. Which I’ve no doubt will only be one of many after it.
It seems to be expecting a __MAC_OS_X_VERSION_MIN_REQUIRED <= __MAC_10_6
as in
#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED <= __MAC_10_6
hmm.
EDIT:
Let me be more specific.
This code extract is from MemoryX.h about line 363 - right before the #endif that starts this block - noted above , if <= __MAC_10_6
So the first error generated now is -
"Expected “;” after alias declaration - about line 380, and
“Unknown type name 'unique_ptr” - on about line 380.
I’m saying ‘about’ because I modified the file once, and moved the line numbers fractionally.
The first hides naked NEW and DELETE from the source code.
The second hides NEW[] and DELETE[]. Both of course ensure destruction if
you don't use something like std::move(p) or q.release(). Both expressions require
that you identify the type only once, which is brief and less error prone.
(Whereas this omission of [] might invite a runtime error:
std::unique_ptr<Myclass> q { new Myclass[count] }; )
Some C++11 tricks needed here are (1) variadic argument lists and
(2) making the compile-time dispatch work correctly. You can't have
a partially specialized template function, but you get the effect of that
by other metaprogramming means.
*/
namespace std {
// For overloading resolution
template <typename X> struct __make_unique_result {
using scalar_case = unique_ptr<X>;
};
// Partial specialization of the struct for array case
template <typename X> struct __make_unique_result<X[]> {
using array_case = unique_ptr<X[]>;
using element = X;
};
// Now the scalar version of unique_ptr
template<typename X, typename... Args> inline
typename __make_unique_result<X>::scalar_case
make_unique(Args&&... args)
{
return typename __make_unique_result<X>::scalar_case
{ safenew X(forward<Args>(args)...) };
}
// Now the array version of unique_ptr
// The compile-time dispatch trick is that the non-existence
// of the scalar_case type makes the above overload
// unavailable when the template parameter is explicit
template<typename X> inline
typename __make_unique_result<X>::array_case
make_unique(size_t count)
{
return typename __make_unique_result<X>::array_case
{ safenew typename __make_unique_result<X>::element[count] };
}
}
#endif
and yes, I know it’s not supported - I am as usual working on my own, way out the front. Just hoping to catch the eye of anyone else working on advanced levels…
thanks
Robert