Defines | |
#define | STLSOFT_GEN_TRAIT_SPECIALISATION(TR, T, V) |
Used to define a specialisation of a traits type. | |
#define | STLSOFT_GEN_TRAIT_SPECIALISATION_WITH_TYPE(TR, T, V, MT) |
Used to define a specialisation of a traits type that contains a member type. | |
#define | stlsoft_throw_0() |
Indicates that the given function/method does not throw any exceptions. | |
#define | stlsoft_throw_1(x1) |
Indicates that the given function/method throws the named type. | |
#define | stlsoft_throw_2(x1, x2) |
Indicates that the given function/method throws the two named types. | |
#define | stlsoft_throw_3(x1, x2, x3) |
Indicates that the given function/method throws the three named types. | |
#define | stlsoft_throw_4(x1, x2, x3, x4) |
Indicates that the given function/method throws the four named types. | |
#define | stlsoft_throw_5(x1, x2, x3, x4, x5) |
Indicates that the given function/method throws the five named types. | |
#define | stlsoft_throw_6(x1, x2, x3, x4, x5, x6) |
Indicates that the given function/method throws the six named types. | |
#define | stlsoft_throw_7(x1, x2, x3, x4, x5, x6, x7) |
Indicates that the given function/method throws the seven named types. | |
#define | stlsoft_throw_8(x1, x2, x3, x4, x5, x6, x7, x8) |
Indicates that the given function/method throws the eight named types. | |
#define | STLSOFT_NUM_ELEMENTS(ar) |
Evaluates, at compile time, to the number of elements within the given vector entity. | |
#define | stlsoft_num_elements(ar) STLSOFT_NUM_ELEMENTS(ar) |
Evaluates, at compile time, to the number of elements within the given vector entity. | |
#define | STLSOFT_RAW_OFFSETOF(S, M) stlsoft_reinterpret_cast(stlsoft_ns_qual(ss_size_t), &stlsoft_static_cast(S*, 0)->M) |
Evaluates, at compile time, the offset of the member m in the structure s . | |
#define | stlsoft_raw_offsetof(s, m) STLSOFT_RAW_OFFSETOF(s, m) |
Evaluates, at compile time, the offset of a structure/class member. | |
#define | STLSOFT_DESTROY_INSTANCE(T1, T2, P) do { (P)->~T1(); } while(0) |
#define | stlsoft_destroy_instance(T1, T2, P) STLSOFT_DESTROY_INSTANCE(T1, T2, P) |
Explicitly destroys an instance. | |
#define | STLSOFT_GEN_OPAQUE(type) typedef struct __stlsoft_htype##type{ int i;} const* type; |
Generates an opaque type with the name type . | |
#define | stlsoft_gen_opaque(Type) STLSOFT_GEN_OPAQUE(Type) |
Generates an opaque type with the name Type . | |
#define | STLSOFT_DECLARE_TEMPLATE_PARAM_AS_FRIEND(T) friend T |
Declares a template (class) parameter to be a friend of the template. | |
#define | STLSOFT_SUPPRESS_UNUSED(x) (static_cast<void>(x)) |
Used to suppress unused variable warnings. | |
#define | STLSOFT_UNNAMED_PARAM(p) p |
Used to define an unused parameter for C compilation and/or documentation processing, but not for C++ compilation. | |
#define | STLSOFT_SUPPRESS_UNNAMED_PARAM(p) ((void)p); |
Used to suppress unused parameter warnings (in C compilation) for parameters defined by STLSOFT_UNNAMED_PARAM(). |
#define STLSOFT_DECLARE_TEMPLATE_PARAM_AS_FRIEND | ( | T | ) | friend T |
Declares a template (class) parameter to be a friend of the template.
Is it used as follows:
template<typename T> class Thing { STLSOFT_DECLARE_TEMPLATE_PARAM_AS_FRIEND(T); private: int m_member; // Thing<T>::m_member visible to T };
#define stlsoft_destroy_instance | ( | T1, | |||
T2, | |||||
P | ) | STLSOFT_DESTROY_INSTANCE(T1, T2, P) |
Explicitly destroys an instance.
#define STLSOFT_DESTROY_INSTANCE | ( | T1, | |||
T2, | |||||
P | ) | do { (P)->~T1(); } while(0) |
T1 | The type to be destroyed, as a template parameter (e.g. T) | |
T2 | The type to be destroyed, as a typedef (e.g. value_type) | |
P | Pointer (T*) to the instance to be explicitly destroyed |
P
of the given type (T1
and T2
)
Referenced by allocator_base< T, stlsoft::new_allocator< T > >::destroy().
#define stlsoft_gen_opaque | ( | Type | ) | STLSOFT_GEN_OPAQUE(Type) |
Generates an opaque type with the name Type
.
#define STLSOFT_GEN_OPAQUE | ( | type | ) | typedef struct __stlsoft_htype##type{ int i;} const* type; |
Generates an opaque type with the name type
.
For example, the following defines two distinct opaque types:
STLSOFT_GEN_OPAQUE(HThread) STLSOFT_GEN_OPAQUE(HProcess)
The two types are incompatible with each other, and with any other types (except that they are both convertible to void const*
#define STLSOFT_GEN_TRAIT_SPECIALISATION | ( | TR, | |||
T, | |||||
V | ) |
Value:
\ STLSOFT_TEMPLATE_SPECIALISATION \ struct TR<T> \ { \ enum { value = V }; \ };
#define STLSOFT_GEN_TRAIT_SPECIALISATION_WITH_TYPE | ( | TR, | |||
T, | |||||
V, | |||||
MT | ) |
Value:
\ STLSOFT_TEMPLATE_SPECIALISATION \ struct TR<T> \ { \ enum { value = V }; \ \ typedef MT type; \ };
#define stlsoft_num_elements | ( | ar | ) | STLSOFT_NUM_ELEMENTS(ar) |
Evaluates, at compile time, to the number of elements within the given vector entity.
ar | The array |
#define STLSOFT_NUM_ELEMENTS | ( | ar | ) |
Evaluates, at compile time, to the number of elements within the given vector entity.
ar | The array |
int ai[20]; int i = 32; int *pi = &i; std::vector<int> vi; size_t s_ai = STLSOFT_NUM_ELEMENTS(ai); // Ok size_t s_i = STLSOFT_NUM_ELEMENTS(i); // Error size_t s_pi = STLSOFT_NUM_ELEMENTS(pi); // Error size_t s_vi = STLSOFT_NUM_ELEMENTS(vi); // Error
operator []
. This helps to avoid the common gotcha whereby (sizeof(ar) / sizeof(ar[0]))
is applied to such types, without causing a compiler error.From STLSoft 1.8.3 onwards, the underlying ss_static_array_size function is changed to return reference to const ss_array_size_struct, rather than ss_array_size_struct, so as to avoid Visual C++ (7.1)'s C4686 warning
Referenced by c_str_ptr_GUID_proxy::c_str_ptr_GUID_proxy(), stlsoft::format_bytes(), stlsoft::format_thousands(), invalid_integral_range_policy::operator()(), winstl::w4mo_helper_8(), winstl__control_panel_newinquire(), winstl__IsWindowClassA(), and winstl__IsWindowClassW().
#define stlsoft_raw_offsetof | ( | s, | |||
m | ) | STLSOFT_RAW_OFFSETOF(s, m) |
Evaluates, at compile time, the offset of a structure/class member.
#define STLSOFT_RAW_OFFSETOF | ( | S, | |||
M | ) | stlsoft_reinterpret_cast(stlsoft_ns_qual(ss_size_t), &stlsoft_static_cast(S*, 0)->M) |
Evaluates, at compile time, the offset of the member m
in the structure s
.
S | The type of the structure/class | |
M | The name of the member |
Referenced by auto_buffer< C, internalBufferSize, winstl::processheap_allocator< C > >::auto_buffer(), window_enable_scope::~window_enable_scope(), window_icon_scope::~window_icon_scope(), and window_visible_scope::~window_visible_scope().
#define STLSOFT_SUPPRESS_UNNAMED_PARAM | ( | p | ) | ((void)p); |
Used to suppress unused parameter warnings (in C compilation) for parameters defined by STLSOFT_UNNAMED_PARAM().
#define STLSOFT_SUPPRESS_UNUSED | ( | x | ) | (static_cast<void>(x)) |
Used to suppress unused variable warnings.
Referenced by stlsoft::lock_instance(), invalid_integral_range_policy::operator()(), addref_release::operator()(), ignore_interface_cast_exception::operator()(), stlsoft::ptr_byte_offset(), stlsoft::string_dup(), stlsoft::trim_all(), stlsoft::trim_left(), stlsoft::trim_right(), union_caster::union_caster(), stlsoft::unlock_instance(), and member_selector_iterator::~member_selector_iterator().
#define stlsoft_throw_0 | ( | ) |
Indicates that the given function/method does not throw any exceptions.
#define stlsoft_throw_1 | ( | x1 | ) |
Indicates that the given function/method throws the named type.
#define stlsoft_throw_2 | ( | x1, | |||
x2 | ) |
Indicates that the given function/method throws the two named types.
#define stlsoft_throw_3 | ( | x1, | |||
x2, | |||||
x3 | ) |
Indicates that the given function/method throws the three named types.
#define stlsoft_throw_4 | ( | x1, | |||
x2, | |||||
x3, | |||||
x4 | ) |
Indicates that the given function/method throws the four named types.
#define stlsoft_throw_5 | ( | x1, | |||
x2, | |||||
x3, | |||||
x4, | |||||
x5 | ) |
Indicates that the given function/method throws the five named types.
#define stlsoft_throw_6 | ( | x1, | |||
x2, | |||||
x3, | |||||
x4, | |||||
x5, | |||||
x6 | ) |
Indicates that the given function/method throws the six named types.
#define stlsoft_throw_7 | ( | x1, | |||
x2, | |||||
x3, | |||||
x4, | |||||
x5, | |||||
x6, | |||||
x7 | ) |
Indicates that the given function/method throws the seven named types.
#define stlsoft_throw_8 | ( | x1, | |||
x2, | |||||
x3, | |||||
x4, | |||||
x5, | |||||
x6, | |||||
x7, | |||||
x8 | ) |
Indicates that the given function/method throws the eight named types.
#define STLSOFT_UNNAMED_PARAM | ( | p | ) | p |
Used to define an unused parameter for C compilation and/or documentation processing, but not for C++ compilation.