diff options
Diffstat (limited to 'src/inc/holderinst.h')
-rw-r--r-- | src/inc/holderinst.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/inc/holderinst.h b/src/inc/holderinst.h new file mode 100644 index 0000000000..ee59da0842 --- /dev/null +++ b/src/inc/holderinst.h @@ -0,0 +1,33 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + + +#ifndef __HOLDERINST_H_ +#define __HOLDERINST_H_ + +// This file contains holder instantiations which we can't put in holder.h because +// the instantiations require _ASSERTE to be defined, which is not always the case +// for placed that include holder.h. + +FORCEINLINE void SafeArrayRelease(SAFEARRAY* p) +{ + SafeArrayDestroy(p); +} + + +class SafeArrayHolder : public Wrapper<SAFEARRAY*, SafeArrayDoNothing, SafeArrayRelease, NULL> +{ +public: + SafeArrayHolder(SAFEARRAY* p = NULL) + : Wrapper<SAFEARRAY*, SafeArrayDoNothing, SafeArrayRelease, NULL>(p) + { + } + + FORCEINLINE void operator=(SAFEARRAY* p) + { + Wrapper<SAFEARRAY*, SafeArrayDoNothing, SafeArrayRelease, NULL>::operator=(p); + } +}; + +#endif // __HOLDERINST_H_ |