[Boost-bugs] [Boost C++ Libraries] #1737: Add AllocatorConcept to BCCL

Subject: [Boost-bugs] [Boost C++ Libraries] #1737: Add AllocatorConcept to BCCL
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-03-31 15:07:01

#1737: Add AllocatorConcept to BCCL
 Reporter: mfawcett | Owner: jsiek
     Type: Feature Requests | Status: new
Milestone: Boost 1.36.0 | Component: concept_check
  Version: Boost Development Trunk | Severity: Not Applicable
 Keywords: concept_check, concepts, allocator |
 It would be convenient to have an AllocatorConcept in the Boost Concept
 Check Library. Below is a nearly complete implementation.

 -- code --

 namespace boost {

 template <typename T>
 struct AllocatorConcept {
        typedef typename T::const_pointer const_pointer;
        typedef typename T::const_reference const_reference;
        typedef typename T::difference_type difference_type;
        typedef typename T::pointer pointer;
        typedef typename T::reference reference;
        typedef typename T::size_type size_type;
        typedef typename T::value_type value_type;
        // TODO: Do we need to do more here, e.g.
 char_allocator_type::rebind<value_type>::other == T?
        typedef typename T::template rebind<char>::other

        BOOST_CLASS_REQUIRE(T, boost, DefaultConstructibleConcept);
        BOOST_CLASS_REQUIRE(T, boost, CopyConstructibleConcept);
        BOOST_CLASS_REQUIRE(T, boost, EqualityComparableConcept);

        void constraints() {
                pointer p = 0;
                reference ref = *p;
                const_reference cref = *p;

                p = value.address(ref);
                const_pointer cp = value.address(cref);

                p = value.allocate(1);
                p = value.allocate(1, 0);

                value.construct(p, *p);

                value.deallocate(p, 1);


                size_type s = value.max_size();

        T value;

Ticket URL: <http://svn.boost.org/trac/boost/ticket/1737>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC