You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2007/06/07 00:36:26 UTC

svn commit: r544975 - in /incubator/stdcxx/trunk/include: string string.cc

Author: sebor
Date: Wed Jun  6 15:36:23 2007
New Revision: 544975

URL: http://svn.apache.org/viewvc?view=rev&rev=544975
Log:
2007-06-06  Martin Sebor  <se...@roguewave.com>

	STDCXX-271
	* string (_RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES): New convenience
	macro #defined in response to the various conditions previously tested
	throughout the header and .cc file.
	(__rw_replace, __rw_replace_aux, replace): Guarded global and member
	functions with said macro.
	Replaced guards for specific version(s) of MSVC with the config macro
	_RWSTD_NO_MEMBER_TEMPLATES (tested by artificially defining the macro
	on the command line).
	* string.cc (__rw_replace, __rw_replace_aux, replace): Same as above.

Modified:
    incubator/stdcxx/trunk/include/string
    incubator/stdcxx/trunk/include/string.cc

Modified: incubator/stdcxx/trunk/include/string
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/include/string?view=diff&rev=544975&r1=544974&r2=544975
==============================================================================
--- incubator/stdcxx/trunk/include/string (original)
+++ incubator/stdcxx/trunk/include/string Wed Jun  6 15:36:23 2007
@@ -47,8 +47,15 @@
 _RWSTD_NAMESPACE (std) { 
 
 
-#if    defined (_RWSTD_NO_MEMBER_TEMPLATES)                                   \
+#if    (   defined (_RWSTD_NO_MEMBER_TEMPLATES)   \
+        || defined (_RWSTD_NO_EXTERN_MEMBER_TEMPLATE)) \
     && (!defined (_MSC_VER) || _MSC_VER >= 1300 || defined (__INTEL_COMPILER))
+#  define _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
+#endif   // _RWSTD_NO_STRING_MEMBER_TEMPLATES
+
+
+#ifndef _RWSTD_NO_MEMBER_TEMPLATES
+#  ifdef _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
 
 template <class _CharT, class _Traits, class _Alloc,
           class _StringIter, class _InputIter>
@@ -62,7 +69,8 @@
 __rw_replace_aux (std::basic_string<_CharT, _Traits, _Alloc>&, 
                   _StringIter, _StringIter, _InputIter, _InputIter);
 
-#endif   // NO_MEMBER_TEMPLATES
+#  endif   // _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
+#endif   // _RWSTD_NO_MEMBER_TEMPLATES
 
 
 _EXPORT
@@ -171,7 +179,7 @@
                   const allocator_type& = allocator_type ());
 
 
-#if    !defined (_MSC_VER) || _MSC_VER >= 1300 || defined (__INTEL_COMPILER)
+#ifndef _RWSTD_NO_MEMBER_TEMPLATES
 
     // 21.3.1, p15
     template <class _InputIter>
@@ -182,7 +190,7 @@
                  __first, __last);
     }
 
-#endif // !defined (_MSC_VER) || _MSC_VER >= 1300 || defined (__INTEL_COMPILER)
+#endif   // _RWSTD_NO_MEMBER_TEMPLATES
 
     basic_string (const_pointer, const_pointer, const allocator_type&
                   _RWSTD_REDECLARED_DEFAULT (allocator_type ()));
@@ -296,7 +304,7 @@
         return replace (size (), size_type (), __s);
     }
 
-#if    !defined (_MSC_VER) || _MSC_VER >= 1300 || defined (__INTEL_COMPILER)
+#ifndef _RWSTD_NO_MEMBER_TEMPLATES
 
     template<class _InputIter>
     basic_string& append (_InputIter __first, _InputIter __last) {
@@ -318,14 +326,14 @@
         return replace (size (), size_type (), __n, __c);
     }
 
-#else   // if _MSC_VER < 1300 && !defined (__INTEL_COMPILER)
+#else   // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
 
     basic_string& append (const_pointer __first, const_pointer __last) {
         replace (size (), size_type (), __first, __last - __first);
         return *this;
     }
 
-#endif // !defined (_MSC_VER) || _MSC_VER >= 1300 || defined (__INTEL_COMPILER)
+#endif   // _RWSTD_NO_MEMBER_TEMPLATES
 
     basic_string& append (size_type __n, value_type __c) {
         return replace (size (), size_type (), __n, __c);
@@ -351,7 +359,7 @@
     }
 
 
-#if    !defined (_MSC_VER) || _MSC_VER >= 1300 || defined (__INTEL_COMPILER)
+#ifndef _RWSTD_NO_MEMBER_TEMPLATES
 
     template<class _InputIter>
     basic_string& assign (_InputIter __first, _InputIter __last) {
@@ -374,14 +382,14 @@
         return replace (size_type (), size (), __n, __c);
     }
 
-#else   // if _MSC_VER < 1300 && !defined (__INTEL_COMPILER)
+#else   // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
 
     basic_string& assign (const_pointer __first, const_pointer __last) {
         replace (size_type (), size (), __first, __last - __first);
         return *this;
     }
 
-#endif  // !defined (_MSC_VER) || _MSC_VER >= 1300 || defined (__INTEL_COMPILER)
+#endif   // _RWSTD_NO_MEMBER_TEMPLATES
 
     basic_string& assign (size_type __n, value_type __c) {
         return replace (size_type (), size (), __n, __c);
@@ -406,7 +414,7 @@
         return insert (__inx, &__c, 1), begin () + __inx;
     }
 
-#if    !defined (_MSC_VER) || _MSC_VER >= 1300 || defined (__INTEL_COMPILER)
+#ifndef _RWSTD_NO_MEMBER_TEMPLATES
 
     template<class _InputIter>
     void insert (iterator __p, _InputIter __first, _InputIter __last) {
@@ -452,7 +460,7 @@
 
 #  endif   // _RWSTD_NO_DEBUG_ITER
 
-#else   // if _MSC_VER < 1300 && !defined (__INTEL_COMPILER)
+#else   // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
 
     void insert (iterator __p, const_pointer __first, const_pointer __last) {
         if (__first >= _C_data && __first <= _C_data + size ())
@@ -461,7 +469,7 @@
             replace (__p, __p, __first, __last);
     }
 
-#endif  // !defined (_MSC_VER) || _MSC_VER >= 1300 || defined (__INTEL_COMPILER)
+#endif   // _RWSTD_NO_MEMBER_TEMPLATES
     
 
     void insert (iterator __it, size_type __n, value_type __c) {
@@ -501,17 +509,14 @@
         return _C_make_iter (_C_data + __pos1);
     }
 
+public:
 
-#if    !defined (_MSC_VER) || _MSC_VER >= 1300 || defined (__INTEL_COMPILER)
-
-#  ifndef _RWSTD_NO_MEMBER_TEMPLATES
+#ifndef _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
 
     template <class _InputIter>
     basic_string& __replace_aux (iterator, iterator, _InputIter, _InputIter);
 
-#  else   // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
-
-public:
+#else
 
     template <class _InputIter>
     basic_string& __replace_aux (iterator __first1, iterator __last1, 
@@ -519,9 +524,7 @@
         return __rw_replace_aux (*this, __first1, __last1, __first2, __last2);
     }
 
-#  endif   // _RWSTD_NO_MEMBER_TEMPLATES
-
-#endif // !defined (_MSC_VER) || _MSC_VER >= 1300 || defined (__INTEL_COMPILER)
+#endif   // _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
 
     size_type _C_grow (size_type, size_type) const;
 
@@ -577,16 +580,16 @@
         return replace (_C_off (__first), _C_off (__first, __last), __n, __c);
     }
 
-#if    !defined (_MSC_VER) || _MSC_VER >= 1300 || defined (__INTEL_COMPILER)
+#ifndef _RWSTD_NO_MEMBER_TEMPLATES
 
-#  ifndef _RWSTD_NO_MEMBER_TEMPLATES
+#  ifndef _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
 
     template<class _InputIter>
     basic_string&
     replace (iterator __first1, iterator __last1, 
              _InputIter __first2, _InputIter __last2, void*);
 
-#  else   // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
+#  else   // if defined (_RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES)
 
     template<class _InputIter>
     basic_string&
@@ -595,7 +598,7 @@
         return __rw_replace (*this, __first1, __last1, __first2, __last2);
     }
 
-#  endif   // _RWSTD_NO_MEMBER_TEMPLATES
+#  endif   // _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
 
     basic_string&
     replace (iterator __first, iterator __last,
@@ -612,17 +615,17 @@
                         _RWSTD_DISPATCH (_InputIter));
     }
 
-#else   // if _MSC_VER < 1300 && !defined (__INTEL_COMPILER)
+#else   // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
 
     basic_string&
     replace (iterator __first1, iterator __last1,
              const_pointer __first2, const_pointer __last2) {
         replace (_C_off (__first1), _C_off (__first1, __last1),
-                 __first2, _C_off (__first2, __last2));
+                 __first2, size_type (__last2 - __first2));
         return *this;
     }
 
-#endif  // !defined (_MSC_VER) || _MSC_VER >= 1300 || defined (__INTEL_COMPILER)
+#endif   // _RWSTD_NO_MEMBER_TEMPLATES
 
 
     // 21.3.5.7, p1
@@ -812,16 +815,15 @@
     }
 #endif
 
-#if    defined (_RWSTD_NO_MEMBER_TEMPLATES)                                    \
-    && (!defined (_MSC_VER) || _MSC_VER >= 1300 || defined (__INTEL_COMPILER))
+#ifndef _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
 
-public:
+private:
 
-#else
+#else   // if defined (_RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATSE)
 
-private:
+public:
 
-#endif
+#endif   // _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
 
     static size_type
     _C_off (const_iterator __first, const_iterator __last) {

Modified: incubator/stdcxx/trunk/include/string.cc
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/include/string.cc?view=diff&rev=544975&r1=544974&r2=544975
==============================================================================
--- incubator/stdcxx/trunk/include/string.cc (original)
+++ incubator/stdcxx/trunk/include/string.cc Wed Jun  6 15:36:23 2007
@@ -479,11 +479,12 @@
 }
 
 
-#if    !defined (_MSC_VER) || _MSC_VER >= 1300 || defined (__INTEL_COMPILER)
+#ifndef _RWSTD_NO_MEMBER_TEMPLATES
 
-#  ifdef _RWSTD_NO_MEMBER_TEMPLATES
+#  ifdef _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
 
-template<class _CharT, class _Traits, class _Alloc, class _StringIter, class _InputIter>
+template <class _CharT, class _Traits, class _Alloc,
+          class _StringIter, class _InputIter>
 _STD::basic_string<_CharT, _Traits, _Alloc>& 
 __rw_replace (_STD::basic_string<_CharT, _Traits, _Alloc> &__s, 
               _StringIter __first1, _StringIter __last1,
@@ -498,7 +499,7 @@
      _C_string_ref_type;
 
 
-#  else   // !defined (_RWSTD_NO_MEMBER_TEMPLATES)
+#  else   // !defined (_RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES)
 
 template<class _CharT, class _Traits, class _Allocator>
 template<class _InputIter>
@@ -509,7 +510,7 @@
 {
   basic_string &__s = *this;
 
-#  endif   // _RWSTD_NO_MEMBER_TEMPLATES
+#  endif   // _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
 
     _RWSTD_ASSERT_RANGE (__first1, __s._C_make_iter (__s._C_data + __s.size ()));
     _RWSTD_ASSERT_RANGE (__first1, __last1);
@@ -570,9 +571,10 @@
 // Avoids the possibility of multiple allocations
 // We still have to copy characters over one at a time.
 
-#  ifdef _RWSTD_NO_MEMBER_TEMPLATES
+#  ifdef _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
 
-template<class _CharT, class _Traits, class _Alloc, class _StringIter, class _InputIter>
+template <class _CharT, class _Traits, class _Alloc,
+          class _StringIter, class _InputIter>
 _STD::basic_string<_CharT, _Traits, _Alloc>& 
 __rw_replace_aux (_STD::basic_string<_CharT, _Traits, _Alloc> &__s, 
                   _StringIter __first1, _StringIter __last1,
@@ -587,7 +589,7 @@
     typedef _RW::__string_ref<value_type, traits_type, allocator_type>
      _C_string_ref_type;
 
-#  else
+#  else   // if !defined (_RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES)
 
 template<class _CharT, class _Traits, class _Allocator>
 template<class _InputIter>
@@ -598,7 +600,7 @@
 {
   basic_string &__s = *this;
 
-#  endif  // _RWSTD_NO_MEMBER_TEMPLATES
+#  endif  // _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
 
     _RWSTD_ASSERT_RANGE (__first1, __s._C_make_iter (__s._C_data 
                                                      + __s.size ()));
@@ -664,7 +666,7 @@
     return __s;
 }
 
-#endif  // !defined (_MSC_VER) || _MSC_VER >= 1300 || defined (__INTEL_COMPILER)
+#endif   // _RWSTD_NO_MEMBER_TEMPLATES
 
 
 template <class _CharT, class _Traits, class _Allocator>