Problem with priority_queue template parameter default

scott snyder snyder@fnal.gov
Mon Nov 15 21:28:00 GMT 1999


hi -

The definition of the priority_queue template in stl/bits/stl_queue.h
doesn't quite match what's specified in the C++ standard.

The standard gives the template parameters for priority_queue as
(sec. 23.2.3.2):

template <class T, class Container = vector<T>,
          class Compare = less<typename Container::value_type> >
class priority_queue {
...


But what we have is:


template <class _Tp, 
          class _Sequence __STL_DEPENDENT_DEFAULT_TMPL(deque<_Tp>),
          class _Compare
          __STL_DEPENDENT_DEFAULT_TMPL(less<typename _Sequence::value_type>) >
class priority_queue {


Note that the default for the second template paramter is different:
the standard specifies vector<>, while we have deque<>.  I think
this should be changed to match the standard.  I've appended a patch;
it didn't cause any changes in the testsuite results when i tried it.

thanks,
sss



1999-11-11  Scott Snyder  <snyder@fnal.gov>

	* stl/bits/stl_queue.h: The C++ standard gives the default for the
	_Sequence template argument of priority_queue<> as vector<>, not
	deque<>.


Index: stl/bits/stl_queue.h
===================================================================
RCS file: /cvs/libstdc++/libstdc++/stl/bits/stl_queue.h,v
retrieving revision 1.9
diff -u -p -r1.9 stl_queue.h
--- stl_queue.h	1999/05/05 00:39:25	1.9
+++ stl_queue.h	1999/11/16 04:01:45
@@ -133,7 +133,7 @@ operator>=(const queue<_Tp, _Sequence>& 
 #endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
 
 template <class _Tp, 
-          class _Sequence __STL_DEPENDENT_DEFAULT_TMPL(deque<_Tp>),
+          class _Sequence __STL_DEPENDENT_DEFAULT_TMPL(vector<_Tp>),
           class _Compare
           __STL_DEPENDENT_DEFAULT_TMPL(less<typename _Sequence::value_type>) >
 class priority_queue {


More information about the Libstdc++ mailing list