Boost logo

Boost-Commit :

From: mmarcus_at_[hidden]
Date: 2008-06-29 13:48:17


Author: mmarcus
Date: 2008-06-29 13:48:17 EDT (Sun, 29 Jun 2008)
New Revision: 46870
URL: http://svn.boost.org/trac/boost/changeset/46870

Log:
Added HasSize concepts. Added HasSize and Swappable requirements to
adapters.

Text files modified:
   sandbox/committee/concepts/stdlib/clib-containers.tex | 22 +++++++++++++++++++---
   sandbox/committee/concepts/stdlib/lib-issues.txt | 2 +-
   2 files changed, 20 insertions(+), 4 deletions(-)

Modified: sandbox/committee/concepts/stdlib/clib-containers.tex
==============================================================================
--- sandbox/committee/concepts/stdlib/clib-containers.tex (original)
+++ sandbox/committee/concepts/stdlib/clib-containers.tex 2008-06-29 13:48:17 EDT (Sun, 29 Jun 2008)
@@ -2722,9 +2722,25 @@
 
 \begin{codeblock}
 namespace std {
+
+ @\addedCC{concept HasSize<typename T> \{}@
+ @\addedCC{typename size_type;}@
+ @ \addedCC{size_type size(const T\&);}@
+ @\addedCC{\}}@
+ @\addedCC{}@
+ @\addedCC{auto concept HasMemberSize<typename T> \{}@
+ @\addedCC{typename size_type = T::size_type;}@
+ @\addedCC{size_type T::size() const;}@
+ @\addedCC{\} }@
+ @\addedCC{}@
+ @\addedCC{template <HasMemberSize C>}@
+ @\addedCC{concept_map HasSize<C> \{}@
+ @\addedCC{C::size_type size(const C\& c) \{ return c.size(); \} }@
+ @\addedCC{\}}@
+
   template <@\changedConcepts{class}{ObjectType}@ T, class Cont@\removedConcepts{ainer}@ = deque<T> >
   @\addedConcepts{requires FrontInsertionSequence<Cont> \&\& BackInsertionSequence<Cont>}@
- @\addedConcepts{ \&\& SameType<T, Cont::value_type>}@
+ @\addedConcepts{ \&\& SameType<T, Cont::value_type>}@@\addedCC{ \&\& HasSize<Cont> \&\& Swappable<Cont>}@
   class queue {
   public:
     typedef typename Cont@\removedConcepts{ainer}@::value_type value_type;
@@ -2926,7 +2942,7 @@
   template <@\changedConcepts{class}{ObjectType}@ T, @\changedConcepts{class}{BackInsertionSequence}@ Cont@\removedConcepts{ainer}@ = vector<T>,
        @\changedConcepts{class}{Predicate<auto, T, T>}@ Compare = less<typename Cont@\removedConcepts{ainer}@::value_type> >
   @\addedConcepts{requires SameType<Cont::value_type, T> \&\& MutableRandomAccessIterator<Cont::iterator>}@
- @\addedConcepts{\&\& Swappable}@@\removedCCC{Iterator}@@\addedConcepts{<Cont::iterator}@@\addedCC{::reference}@@\addedConcepts{> \&\& CopyConstructible<Compare>}@
+ @\addedConcepts{\&\& Swappable}@@\removedCCC{Iterator}@@\addedConcepts{<Cont::iterator}@@\addedCC{::reference}@@\addedConcepts{> \&\& CopyConstructible<Compare>}@@\addedCC{ \&\& HasSize<Cont> \&\& Swappable<Cont>}@
   class priority_queue {
   public:
     typedef typename Cont@\removedConcepts{ainer}@::value_type value_type;
@@ -3142,7 +3158,7 @@
 \begin{codeblock}
 namespace std {
   template <@\changedConcepts{class}{ObjectType}@ T, @\changedConcepts{class}{BackInsertionSequence}@ Cont@\removedConcepts{ainer}@ = deque<T> >
- @\addedConcepts{requires SameType<Cont::value_type, T>}@
+ @\addedConcepts{requires SameType<Cont::value_type, T>}@@\addedCC{ \&\& HasSize<Cont> \&\& Swappable<Cont>}@
   class stack {
   public:
     typedef typename Cont@\removedConcepts{ainer}@::value_type value_type;

Modified: sandbox/committee/concepts/stdlib/lib-issues.txt
==============================================================================
--- sandbox/committee/concepts/stdlib/lib-issues.txt (original)
+++ sandbox/committee/concepts/stdlib/lib-issues.txt 2008-06-29 13:48:17 EDT (Sun, 29 Jun 2008)
@@ -414,7 +414,7 @@
 y * Adaptors should require NothrowDestructible? (related issues worthy of exploration).
 
 y * Implementations of stack members will change to free functions.
- (Mat: done except for 1) need concept for size() 2) should effects
+ (Mat: done except for 1) added concept for size()--wrong place? 2) should effects
     be concept qualified? 3) swappable size on Cont or on member
     functions. Same questions for queue family. 4) not tested or reviewed
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk