sequence_concepts.h

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
00016 
00017 #include <container_concepts.h>
00018 
00019 #ifdef __STL_USE_CONCEPT_CHECKS
00020 
00021 // This file covers the following concepts:
00022 //       _Sequence
00023 //       _FrontInsertionSequence
00024 //       _BackInsertionSequence
00025 
00026 struct _ERROR_IN_STL_SEQ {
00027 
00028   template <class _XX>
00029   static void
00030   __fill_constructor_requirement_violation(_XX& __s) {
00031     typename _XX::value_type __t = typename _XX::value_type();
00032     typename _XX::difference_type __n = typename _XX::difference_type();
00033     _XX __x(__n, __t);
00034     __sink_unused_warning(__x);
00035   }
00036   template <class _XX>
00037   static void
00038   __fill_default_constructor_requirement_violation(_XX& __s) {
00039     _STL_ERROR::__default_constructor_requirement_violation(*__s.begin());
00040     typename _XX::difference_type __n = typename _XX::difference_type();
00041     _XX __x(__n);
00042     __sink_unused_warning(__x);
00043   }  
00044   template <class _XX>
00045   static void
00046   __range_constructor_requirement_violation(_XX& __s) {
00047     _XX __x(__s.begin(), __s.end());
00048     __sink_unused_warning(__x);
00049   }
00050   template <class _XX>
00051   static void
00052   __insert_function_requirement_violation(_XX& __s) {
00053     typename _XX::value_type __t = typename _XX::value_type();
00054     typename _XX::iterator __p = typename _XX::iterator();
00055     __p = __s.insert(__p, __t);
00056   }
00057   template <class _XX>
00058   static void
00059   __fill_insert_function_requirement_violation(_XX& __s) {
00060     typename _XX::value_type __t = typename _XX::value_type();
00061     typename _XX::iterator __p = typename _XX::iterator();
00062     typename _XX::difference_type __n = typename _XX::difference_type();
00063     __s.insert(__p, __n, __t);
00064   }
00065   template <class _XX>
00066   static void
00067   __range_insert_function_requirement_violation(_XX& __s) {
00068     typename _XX::iterator __p = typename _XX::iterator();
00069     typename _XX::iterator __i = typename _XX::iterator();
00070     typename _XX::iterator __j = typename _XX::iterator();
00071     __s.insert(__p, __i, __j);
00072   }
00073   template <class _XX>
00074   static void
00075   __insert_element_function_requirement_violation(_XX& __s) {
00076     typename _XX::value_type __t = typename _XX::value_type();
00077     std::pair<typename _XX::iterator, bool> __r;
00078     __r = __s.insert(__t);
00079     __sink_unused_warning(__r);
00080   }
00081   template <class _XX>
00082   static void
00083   __unconditional_insert_element_function_requirement_violation(_XX& __s) {
00084     typename _XX::value_type __t = typename _XX::value_type();
00085     typename _XX::iterator __p;
00086     __p = __s.insert(__t);
00087     __sink_unused_warning(__p);
00088   }
00089   template <class _XX>
00090   static void
00091   __erase_function_requirement_violation(_XX& __s) {
00092     typename _XX::iterator __p = typename _XX::iterator();
00093     __p = __s.erase(__p);
00094   }
00095   template <class _XX>
00096   static void
00097   __range_erase_function_requirement_violation(_XX& __s) {
00098     typename _XX::iterator __p = typename _XX::iterator();
00099     typename _XX::iterator __q = typename _XX::iterator();
00100     __p = __s.erase(__p, __q);
00101   }
00102   template <class _XX>
00103   static void
00104   __const_front_function_requirement_violation(const _XX& __s) {
00105     typename _XX::const_reference __t = __s.front();
00106     __sink_unused_warning(__t);
00107   }
00108   template <class _XX>
00109   static void
00110   __front_function_requirement_violation(_XX& __s) {
00111     typename _XX::reference __t = __s.front();
00112     __const_front_function_requirement_violation(__s);
00113     __sink_unused_warning(__t);
00114   }
00115   template <class _XX>
00116   static void
00117   __const_back_function_requirement_violation(const _XX& __s) {
00118     typename _XX::const_reference __t = __s.back();
00119     __sink_unused_warning(__t);
00120   }
00121   template <class _XX>
00122   static void
00123   __back_function_requirement_violation(_XX& __s) {
00124     typename _XX::reference __t = __s.back();
00125     __const_back_function_requirement_violation(__s);
00126     __sink_unused_warning(__t);
00127   }
00128   template <class _XX>
00129   static void
00130   __push_front_function_requirement_violation(_XX& __s) {
00131     typename _XX::value_type __t = typename _XX::value_type();
00132     __s.push_front(__t);
00133   }
00134   template <class _XX>
00135   static void
00136   __pop_front_function_requirement_violation(_XX& __s) {
00137     __s.pop_front();
00138   }
00139   template <class _XX>
00140   static void
00141   __push_back_function_requirement_violation(_XX& __s) {
00142     typename _XX::value_type __t = typename _XX::value_type();
00143     __s.push_back(__t);
00144   }
00145   template <class _XX>
00146   static void
00147   __pop_back_function_requirement_violation(_XX& __s) {
00148     __s.pop_back();
00149   }
00150 
00151 };
00152 
00153 /* Sequence Containers */
00154 
00155 template <class _Sequence>
00156 struct _Sequence_concept_specification {
00157 static void
00158 _Sequence_requirement_violation(_Sequence __s) {
00159   // Refinement of ForwardContainer
00160   _ForwardContainer_concept_specification<_Sequence>::_ForwardContainer_requirement_violation(__s);
00161   // Refinement of DefaultConstructible
00162   _DefaultConstructible_concept_specification<_Sequence>::_DefaultConstructible_requirement_violation(__s);
00163   // Valid Expressions
00164   _ERROR_IN_STL_SEQ::__fill_constructor_requirement_violation(__s);
00165   _ERROR_IN_STL_SEQ::__fill_default_constructor_requirement_violation(__s);
00166   _ERROR_IN_STL_SEQ::__range_constructor_requirement_violation(__s);
00167   _ERROR_IN_STL_SEQ::__insert_function_requirement_violation(__s);
00168   _ERROR_IN_STL_SEQ::__fill_insert_function_requirement_violation(__s);
00169   _ERROR_IN_STL_SEQ::__range_insert_function_requirement_violation(__s);
00170   _ERROR_IN_STL_SEQ::__erase_function_requirement_violation(__s);
00171   _ERROR_IN_STL_SEQ::__range_erase_function_requirement_violation(__s);
00172   _ERROR_IN_STL_SEQ::__front_function_requirement_violation(__s);
00173 }
00174 };
00175 
00176 template <class _FrontInsertionSequence>
00177 struct _FrontInsertionSequence_concept_specification {
00178 static void
00179 _FrontInsertionSequence_requirement_violation(_FrontInsertionSequence __s) {
00180   // Refinement of Sequence
00181   _Sequence_concept_specification<_FrontInsertionSequence>::_Sequence_requirement_violation(__s);
00182   // Valid Expressions
00183   _ERROR_IN_STL_SEQ::__push_front_function_requirement_violation(__s);
00184   _ERROR_IN_STL_SEQ::__pop_front_function_requirement_violation(__s);
00185 }
00186 };
00187 
00188 template <class _BackInsertionSequence>
00189 struct _BackInsertionSequence_concept_specification {
00190 static void
00191 _BackInsertionSequence_requirement_violation(_BackInsertionSequence __s) {
00192   // Refinement of Sequence
00193   _Sequence_concept_specification<_BackInsertionSequence>::_Sequence_requirement_violation(__s);
00194   // Valid Expressions
00195   _ERROR_IN_STL_SEQ::__back_function_requirement_violation(__s);
00196   _ERROR_IN_STL_SEQ::__push_back_function_requirement_violation(__s);
00197   _ERROR_IN_STL_SEQ::__pop_back_function_requirement_violation(__s);
00198 }
00199 };
00200 
00201 #endif /* if __STL_USE_CONCEPT_CHECKS */
00202 
00203 
00204 #endif /* STL_SEQUENCE_CONCEPTS_H */

Generated on Mon Jun 5 10:20:43 2006 for Intelligence.kdevelop by  doxygen 1.4.6