I have the task of porting some code to c++20. Part of it is an templated allocator that handles some of the odd needs or Microsoft COM objects so we can use them in vectors. In part, it allocates/deallocates memory via CoTaskMemAlloc/CoTaskMemFree It also provides specializations of construct and destroy which have gone way in c++20.
For Example:
// VARIANT
inline void CnvCoTaskAlloc<VARIANT>::construct(VARIANT* p, const VARIANT& val){
::VariantCopy( p, const_cast<VARIANT*>( &val ) );
}
inline void CnvCoTaskAlloc<VARIANT>::destroy(VARIANT* p){
::VariantClear( p );
}
I am having a hard time working out how to migrate this code to c++20. If I could find an example of doing something similar that implements construct, I am pretty sure it would be obvious.
Thanks in Advance.