file
SmartPtrDef.hThis module provides the macro definitions for working with smart pointer templates.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Defines
- #define ptr(self)
- Returns a pointer to the managed object of a Cnx smart pointer.
- #define __ptr(self)
- implementation of
ptr
- #define ptr_const(self)
- Returns a pointer-to-const to the managed object of a Cnx smart pointer.
- #define ptr_mut(self)
- Returns a pointer-to-non-const to the managed object of a Cnx smart pointer.
- #define ptr_move(self)
- Moves
self
into the assigned-to or bound-to variable/parameter/etc. - #define CnxDeleter(T, ...)
- The function type (with optional name, for use in typedefs) of a deleter function used in smart pointer templates.
- #define __SMART_PTR_CHECK_INSTANCE_IS_ARRAY(self)
- checks if the given smart pointer instance manages an array type
- #define __SMART_PTR_IS_ARRAY(T)
- checks if the given type is an array type
- #define __SMART_PTR_ELEMENT_PTR_BASE(T)
- gets the element pointer type for the given array type. e.g if
T
evaluates toint[]
, returnsint*
. - #define __SMART_PTR_CONST_ELEMENT_PTR_BASE(T)
- gets the const element pointer type for the given array type. e.g if
T
evaluates toint[]
, returnsconst int*
. - #define __SMART_PTR_ELEMENT_PTR(T)
- gets the pointer type/element pointer type for the given type used in a smart pointer template. e.g. if
T
evalutes toint
, returnsint*
as the pointer-to-int type isint*
, but ifT
evaluates toint[]
, also returnsint*
, as the pointer-to-element type of an array ofint
s isint*
. - #define __SMART_PTR_CONST_ELEMENT_PTR(T)
- gets the pointer to const type/const element pointer type for the given type used in a smart pointer template. e.g. if
T
evalutes toint
, returnsconst int*
as the pointer-to-const-int type isconst int*
, but ifT
evaluates toint[]
, also returnsconst int*
, as the pointer-to-const-element type of an array ofint
s isconst int*
. - #define __SMART_PTR_ELEMENT(T)
- gets the element type for the given type
T
used in a smart pointer template. e.g. itT
evaluates toint
returnsint
, as a smart pointer managing anint
only contains oneint
. But ifT
evaluates toint[]
, also returnsint
because a smart pointer managingint
s contains severalint
elements