Opened 15 years ago

Closed 9 years ago

#1737 closed Feature Requests (wontfix)

Add AllocatorConcept to BCCL

Reported by: mfawcett Owned by: acharles
Milestone: Component: concept_check
Version: Severity: Not Applicable
Keywords: concept_check, concepts, allocator Cc:

Description

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 char_allocator_type;

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);

value.destroy(p);

size_type s = value.max_size();

}

private:

T value;

}; }

Change History (3)

comment:1 by mfawcett, 14 years ago

Milestone: Boost 1.36.0
Version: Boost Development Trunk

comment:2 by acharles, 9 years ago

Owner: changed from jsiek to acharles
Status: newassigned

comment:3 by acharles, 9 years ago

Resolution: wontfix
Status: assignedclosed

Library is unmaintained, therefore, no new features are planned.

Note: See TracTickets for help on using tickets.