Listing 3: Free function examples
/* ///////////////////////////////////////////////////////////// * * ... * * Extract from stlsoft_true_typedef.h * * www: http://www.synesis.com.au/stlsoft * http://www.stlsoft.org/ * * Copyright (C) 2002, Synesis Software Pty Ltd. * (Licensed under the Synesis Software Standard Source License: * http://www.synesis.com.au/licenses/ssssl.html) * * ... * * ////////////////////////////////////////////////////////// */ ... // operator ~ template <ss_typename_param_k T, ss_typename_param_k U> inline true_typedef<T, U> operator ~(const true_typedef<T,U> &v) { return ~v.base_type_value(); } // Pre-increment template <ss_typename_param_k T, ss_typename_param_k U> inline true_typedef<T, U> &operator ++(true_typedef<T, U> &v) { ++v.base_type_value(); return v; } // Post-decrement template <ss_typename_param_k T, ss_typename_param_k U> inline true_typedef<T, U> operator --(true_typedef<T,U> &v, int) { true_typedef<T, U> r(v); v.base_type_value()--; return r; } // operator < template <ss_typename_param_k T, ss_typename_param_k U> inline ss_bool_t operator <(const true_typedef<T, U> &lhs, const true_typedef<T, U> &rhs) { return lhs.base_type_value() < rhs.base_type_value(); } template <ss_typename_param_k T, ss_typename_param_k U> inline ss_bool_t operator <(const true_typedef<T, U> &lhs, const true_typedef<T, U>::value_type &rhs) { return lhs.base_type_value() < rhs; } template <ss_typename_param_k T, ss_typename_param_k U> inline ss_bool_t operator <( const true_typedef<T, U>::value_type &lhs, const true_typedef<T, U> &rhs) { return lhs < rhs.base_type_value(); }