00001 /* ///////////////////////////////////////////////////////////////////////// 00002 * File: stlsoft/meta/member_traits.hpp 00003 * 00004 * Purpose: An amalgamation of meta traits that's been pending reification 00005 * for too long. 00006 * 00007 * Created: 11th October 2004 00008 * Updated: 10th August 2009 00009 * 00010 * Home: http://stlsoft.org/ 00011 * 00012 * Copyright (c) 2004-2009, Matthew Wilson and Synesis Software 00013 * All rights reserved. 00014 * 00015 * Redistribution and use in source and binary forms, with or without 00016 * modification, are permitted provided that the following conditions are met: 00017 * 00018 * - Redistributions of source code must retain the above copyright notice, this 00019 * list of conditions and the following disclaimer. 00020 * - Redistributions in binary form must reproduce the above copyright notice, 00021 * this list of conditions and the following disclaimer in the documentation 00022 * and/or other materials provided with the distribution. 00023 * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of 00024 * any contributors may be used to endorse or promote products derived from 00025 * this software without specific prior written permission. 00026 * 00027 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00028 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00029 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00030 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00031 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00032 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00033 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00034 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00035 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00036 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00037 * POSSIBILITY OF SUCH DAMAGE. 00038 * 00039 * ////////////////////////////////////////////////////////////////////// */ 00040 00041 00048 // An amalgamation of meta traits that's been pending reification for too long. 00049 // 00050 // It defines the member_traits template, which is used to detect the members 00051 // supported by a given type. 00052 00053 #ifndef STLSOFT_INCL_STLSOFT_META_HPP_MEMBER_TRAITS 00054 #define STLSOFT_INCL_STLSOFT_META_HPP_MEMBER_TRAITS 00055 00056 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION 00057 # define STLSOFT_VER_STLSOFT_META_HPP_MEMBER_TRAITS_MAJOR 2 00058 # define STLSOFT_VER_STLSOFT_META_HPP_MEMBER_TRAITS_MINOR 1 00059 # define STLSOFT_VER_STLSOFT_META_HPP_MEMBER_TRAITS_REVISION 1 00060 # define STLSOFT_VER_STLSOFT_META_HPP_MEMBER_TRAITS_EDIT 37 00061 #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00062 00063 /* ///////////////////////////////////////////////////////////////////////// 00064 * Auto-generation and compatibility 00065 */ 00066 00067 /* 00068 [Incompatibilies-start] 00069 STLSOFT_COMPILER_IS_BORLAND: 00070 STLSOFT_COMPILER_IS_DMC: __DMC__ < 0x0845 00071 STLSOFT_COMPILER_IS_MSVC: _MSC_VER < 1310 00072 STLSOFT_COMPILER_IS_WATCOM: 00073 [Incompatibilies-end] 00074 */ 00075 00076 /* ///////////////////////////////////////////////////////////////////////// 00077 * Includes 00078 */ 00079 00080 #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT 00081 # include <stlsoft/stlsoft.h> 00082 #endif /* !STLSOFT_INCL_STLSOFT_H_STLSOFT */ 00083 00084 #ifndef STLSOFT_INCL_STLSOFT_META_HPP_CAPABILITIES 00085 # include <stlsoft/meta/capabilities.hpp> 00086 #endif /* !STLSOFT_INCL_STLSOFT_META_HPP_CAPABILITIES */ 00087 00088 #ifndef STLSOFT_CF_HAS_MEMBER_TYPE_SUPPORTED 00089 # error This file is not compatible with compilers that do not support member type detection 00090 #endif /* !STLSOFT_CF_HAS_MEMBER_TYPE_SUPPORTED */ 00091 00092 #ifndef STLSOFT_INCL_STLSOFT_META_HPP_DETECTORS 00093 # include <stlsoft/meta/detectors.hpp> 00094 #endif /* !STLSOFT_INCL_STLSOFT_META_HPP_DETECTORS */ 00095 00096 /* ///////////////////////////////////////////////////////////////////////// 00097 * Namespace 00098 */ 00099 00100 #ifndef _STLSOFT_NO_NAMESPACE 00101 namespace stlsoft 00102 { 00103 #endif /* _STLSOFT_NO_NAMESPACE */ 00104 00105 /* ///////////////////////////////////////////////////////////////////////// 00106 * Classes 00107 */ 00108 00127 template<ss_typename_param_k T> 00128 struct member_traits 00129 { 00130 public: 00131 typedef T value_type; 00132 typedef member_traits<T> class_type; 00133 00136 public: 00137 00138 #if defined(STLSOFT_CF_HAS_MEMBER_TYPE_SUPPORTED) 00139 enum { has_member_iterator_category = 0 != has_iterator_category<T>::value }; 00140 enum { has_member_value_type = 0 != has_value_type<T>::value }; 00141 enum { has_member_distance_type = 0 != has_distance_type<T>::value }; 00142 enum { has_member_pointer = 0 != has_pointer<T>::value }; 00143 enum { has_member_pointer_type = 0 != has_pointer_type<T>::value }; 00144 enum { has_member_iterator = 0 != has_iterator<T>::value }; 00145 # if !defined(STLSOFT_COMPILER_IS_DMC) || \ 00146 __DMC__ >= 0x0845 00147 enum { has_member_const_iterator = 0 != has_const_iterator<T>::value }; 00148 # endif /* compiler */ 00149 enum { has_member_const_pointer = 0 != has_const_pointer<T>::value }; 00150 # if defined(STLSOFT_COMPILER_IS_MWERKS) 00151 enum { has_member_reference = 0 != has_reference<T>::value }; 00152 enum { has_member_reference_type = 0 != has_reference_type<T>::value }; 00153 enum { has_member_const_reference = 0 != has_const_reference<T>::value }; 00154 # endif /* compiler */ 00155 enum { has_member_difference_type = 0 != has_difference_type<T>::value }; 00156 enum { has_member_key_type = 0 != has_key_type<T>::value }; 00157 enum { has_member_mapped_type = 0 != has_mapped_type<T>::value }; 00158 enum { has_member_referent_type = 0 != has_referent_type<T>::value }; 00159 #endif /* STLSOFT_CF_HAS_MEMBER_TYPE_SUPPORTED */ 00161 00162 // Not to be implemented 00163 private: 00164 member_traits(); 00165 #ifdef STLSOFT_CF_COMPILER_WARNS_NO_PUBLIC_DTOR 00166 protected: 00167 #endif /* STLSOFT_CF_COMPILER_WARNS_NO_PUBLIC_DTOR */ 00168 00169 member_traits(class_type const& rhs); 00170 class_type& operator =(class_type const& rhs); 00171 }; 00172 00173 /* ////////////////////////////////////////////////////////////////////// */ 00174 00175 #ifndef _STLSOFT_NO_NAMESPACE 00176 } // namespace stlsoft 00177 #endif /* _STLSOFT_NO_NAMESPACE */ 00178 00179 /* ////////////////////////////////////////////////////////////////////// */ 00180 00181 #endif /* !STLSOFT_INCL_STLSOFT_META_HPP_MEMBER_TRAITS */ 00182 00183 /* ///////////////////////////// end of file //////////////////////////// */