Whole document tree sequence_concepts.hGo to the documentation of this file.00001 /* 00002 * Copyright (c) 1999 00003 * Silicon Graphics Computer Systems, Inc. 00004 * 00005 * Permission to use, copy, modify, distribute and sell this software 00006 * and its documentation for any purpose is hereby granted without fee, 00007 * provided that the above copyright notice appear in all copies and 00008 * that both that copyright notice and this permission notice appear 00009 * in supporting documentation. Silicon Graphics makes no 00010 * representations about the suitability of this software for any 00011 * purpose. It is provided "as is" without express or implied warranty. 00012 */ 00013 00014 #ifndef _STL_SEQUENCE_CONCEPTS_H 00015 #define _STL_SEQUENCE_CONCEPTS_H 1 00016 00017 #pragma GCC system_header 00018 00019 #include <bits/container_concepts.h> 00020 00021 #ifdef __STL_USE_CONCEPT_CHECKS 00022 00023 // This file covers the following concepts: 00024 // _Sequence 00025 // _FrontInsertionSequence 00026 // _BackInsertionSequence 00027 00028 struct _ERROR_IN_STL_SEQ { 00029 00030 template <class _XX> 00031 static void 00032 __fill_constructor_requirement_violation(_XX& __s) { 00033 typename _XX::value_type __t = typename _XX::value_type(); 00034 typename _XX::difference_type __n = typename _XX::difference_type(); 00035 _XX __x(__n, __t); 00036 __sink_unused_warning(__x); 00037 } 00038 template <class _XX> 00039 static void 00040 __fill_default_constructor_requirement_violation(_XX& __s) { 00041 _STL_ERROR::__default_constructor_requirement_violation(*__s.begin()); 00042 typename _XX::difference_type __n = typename _XX::difference_type(); 00043 _XX __x(__n); 00044 __sink_unused_warning(__x); 00045 } 00046 template <class _XX> 00047 static void 00048 __range_constructor_requirement_violation(_XX& __s) { 00049 _XX __x(__s.begin(), __s.end()); 00050 __sink_unused_warning(__x); 00051 } 00052 template <class _XX> 00053 static void 00054 __insert_function_requirement_violation(_XX& __s) { 00055 typename _XX::value_type __t = typename _XX::value_type(); 00056 typename _XX::iterator __p = typename _XX::iterator(); 00057 __p = __s.insert(__p, __t); 00058 } 00059 template <class _XX> 00060 static void 00061 __fill_insert_function_requirement_violation(_XX& __s) { 00062 typename _XX::value_type __t = typename _XX::value_type(); 00063 typename _XX::iterator __p = typename _XX::iterator(); 00064 typename _XX::difference_type __n = typename _XX::difference_type(); 00065 __s.insert(__p, __n, __t); 00066 } 00067 template <class _XX> 00068 static void 00069 __range_insert_function_requirement_violation(_XX& __s) { 00070 typename _XX::iterator __p = typename _XX::iterator(); 00071 typename _XX::iterator __i = typename _XX::iterator(); 00072 typename _XX::iterator __j = typename _XX::iterator(); 00073 __s.insert(__p, __i, __j); 00074 } 00075 template <class _XX> 00076 static void 00077 __insert_element_function_requirement_violation(_XX& __s) { 00078 typename _XX::value_type __t = typename _XX::value_type(); 00079 std::pair<typename _XX::iterator, bool> __r; 00080 __r = __s.insert(__t); 00081 __sink_unused_warning(__r); 00082 } 00083 template <class _XX> 00084 static void 00085 __unconditional_insert_element_function_requirement_violation(_XX& __s) { 00086 typename _XX::value_type __t = typename _XX::value_type(); 00087 typename _XX::iterator __p; 00088 __p = __s.insert(__t); 00089 __sink_unused_warning(__p); 00090 } 00091 template <class _XX> 00092 static void 00093 __erase_function_requirement_violation(_XX& __s) { 00094 typename _XX::iterator __p = typename _XX::iterator(); 00095 __p = __s.erase(__p); 00096 } 00097 template <class _XX> 00098 static void 00099 __range_erase_function_requirement_violation(_XX& __s) { 00100 typename _XX::iterator __p = typename _XX::iterator(); 00101 typename _XX::iterator __q = typename _XX::iterator(); 00102 __p = __s.erase(__p, __q); 00103 } 00104 template <class _XX> 00105 static void 00106 __const_front_function_requirement_violation(const _XX& __s) { 00107 typename _XX::const_reference __t = __s.front(); 00108 __sink_unused_warning(__t); 00109 } 00110 template <class _XX> 00111 static void 00112 __front_function_requirement_violation(_XX& __s) { 00113 typename _XX::reference __t = __s.front(); 00114 __const_front_function_requirement_violation(__s); 00115 __sink_unused_warning(__t); 00116 } 00117 template <class _XX> 00118 static void 00119 __const_back_function_requirement_violation(const _XX& __s) { 00120 typename _XX::const_reference __t = __s.back(); 00121 __sink_unused_warning(__t); 00122 } 00123 template <class _XX> 00124 static void 00125 __back_function_requirement_violation(_XX& __s) { 00126 typename _XX::reference __t = __s.back(); 00127 __const_back_function_requirement_violation(__s); 00128 __sink_unused_warning(__t); 00129 } 00130 template <class _XX> 00131 static void 00132 __push_front_function_requirement_violation(_XX& __s) { 00133 typename _XX::value_type __t = typename _XX::value_type(); 00134 __s.push_front(__t); 00135 } 00136 template <class _XX> 00137 static void 00138 __pop_front_function_requirement_violation(_XX& __s) { 00139 __s.pop_front(); 00140 } 00141 template <class _XX> 00142 static void 00143 __push_back_function_requirement_violation(_XX& __s) { 00144 typename _XX::value_type __t = typename _XX::value_type(); 00145 __s.push_back(__t); 00146 } 00147 template <class _XX> 00148 static void 00149 __pop_back_function_requirement_violation(_XX& __s) { 00150 __s.pop_back(); 00151 } 00152 00153 }; 00154 00155 /* Sequence Containers */ 00156 00157 template <class _Sequence> 00158 struct _Sequence_concept_specification { 00159 static void 00160 _Sequence_requirement_violation(_Sequence __s) { 00161 // Refinement of ForwardContainer 00162 _ForwardContainer_concept_specification<_Sequence>::_ForwardContainer_requirement_violation(__s); 00163 // Refinement of DefaultConstructible 00164 _DefaultConstructible_concept_specification<_Sequence>::_DefaultConstructible_requirement_violation(__s); 00165 // Valid Expressions 00166 _ERROR_IN_STL_SEQ::__fill_constructor_requirement_violation(__s); 00167 _ERROR_IN_STL_SEQ::__fill_default_constructor_requirement_violation(__s); 00168 _ERROR_IN_STL_SEQ::__range_constructor_requirement_violation(__s); 00169 _ERROR_IN_STL_SEQ::__insert_function_requirement_violation(__s); 00170 _ERROR_IN_STL_SEQ::__fill_insert_function_requirement_violation(__s); 00171 _ERROR_IN_STL_SEQ::__range_insert_function_requirement_violation(__s); 00172 _ERROR_IN_STL_SEQ::__erase_function_requirement_violation(__s); 00173 _ERROR_IN_STL_SEQ::__range_erase_function_requirement_violation(__s); 00174 _ERROR_IN_STL_SEQ::__front_function_requirement_violation(__s); 00175 } 00176 }; 00177 00178 template <class _FrontInsertionSequence> 00179 struct _FrontInsertionSequence_concept_specification { 00180 static void 00181 _FrontInsertionSequence_requirement_violation(_FrontInsertionSequence __s) { 00182 // Refinement of Sequence 00183 _Sequence_concept_specification<_FrontInsertionSequence>::_Sequence_requirement_violation(__s); 00184 // Valid Expressions 00185 _ERROR_IN_STL_SEQ::__push_front_function_requirement_violation(__s); 00186 _ERROR_IN_STL_SEQ::__pop_front_function_requirement_violation(__s); 00187 } 00188 }; 00189 00190 template <class _BackInsertionSequence> 00191 struct _BackInsertionSequence_concept_specification { 00192 static void 00193 _BackInsertionSequence_requirement_violation(_BackInsertionSequence __s) { 00194 // Refinement of Sequence 00195 _Sequence_concept_specification<_BackInsertionSequence>::_Sequence_requirement_violation(__s); 00196 // Valid Expressions 00197 _ERROR_IN_STL_SEQ::__back_function_requirement_violation(__s); 00198 _ERROR_IN_STL_SEQ::__push_back_function_requirement_violation(__s); 00199 _ERROR_IN_STL_SEQ::__pop_back_function_requirement_violation(__s); 00200 } 00201 }; 00202 00203 #endif /* if __STL_USE_CONCEPT_CHECKS */ 00204 00205 00206 #endif /* _STL_SEQUENCE_CONCEPTS_H */ Generated on Mon Apr 8 03:11:31 2002 for libstdc++-v3 Source by ![]() |