pending stuff from Boost Graph Library

[SVN r7704]
This commit is contained in:
Jeremy Siek
2000-09-18 08:24:47 +00:00
commit 6e3ebc8dac
3 changed files with 1117 additions and 0 deletions

96
.gitattributes vendored Normal file
View File

@ -0,0 +1,96 @@
* text=auto !eol svneol=native#text/plain
*.gitattributes text svneol=native#text/plain
# Scriptish formats
*.bat text svneol=native#text/plain
*.bsh text svneol=native#text/x-beanshell
*.cgi text svneol=native#text/plain
*.cmd text svneol=native#text/plain
*.js text svneol=native#text/javascript
*.php text svneol=native#text/x-php
*.pl text svneol=native#text/x-perl
*.pm text svneol=native#text/x-perl
*.py text svneol=native#text/x-python
*.sh eol=lf svneol=LF#text/x-sh
configure eol=lf svneol=LF#text/x-sh
# Image formats
*.bmp binary svneol=unset#image/bmp
*.gif binary svneol=unset#image/gif
*.ico binary svneol=unset#image/ico
*.jpeg binary svneol=unset#image/jpeg
*.jpg binary svneol=unset#image/jpeg
*.png binary svneol=unset#image/png
*.tif binary svneol=unset#image/tiff
*.tiff binary svneol=unset#image/tiff
*.svg text svneol=native#image/svg%2Bxml
# Data formats
*.pdf binary svneol=unset#application/pdf
*.avi binary svneol=unset#video/avi
*.doc binary svneol=unset#application/msword
*.dsp text svneol=crlf#text/plain
*.dsw text svneol=crlf#text/plain
*.eps binary svneol=unset#application/postscript
*.gz binary svneol=unset#application/gzip
*.mov binary svneol=unset#video/quicktime
*.mp3 binary svneol=unset#audio/mpeg
*.ppt binary svneol=unset#application/vnd.ms-powerpoint
*.ps binary svneol=unset#application/postscript
*.psd binary svneol=unset#application/photoshop
*.rdf binary svneol=unset#text/rdf
*.rss text svneol=unset#text/xml
*.rtf binary svneol=unset#text/rtf
*.sln text svneol=native#text/plain
*.swf binary svneol=unset#application/x-shockwave-flash
*.tgz binary svneol=unset#application/gzip
*.vcproj text svneol=native#text/xml
*.vcxproj text svneol=native#text/xml
*.vsprops text svneol=native#text/xml
*.wav binary svneol=unset#audio/wav
*.xls binary svneol=unset#application/vnd.ms-excel
*.zip binary svneol=unset#application/zip
# Text formats
.htaccess text svneol=native#text/plain
*.bbk text svneol=native#text/xml
*.cmake text svneol=native#text/plain
*.css text svneol=native#text/css
*.dtd text svneol=native#text/xml
*.htm text svneol=native#text/html
*.html text svneol=native#text/html
*.ini text svneol=native#text/plain
*.log text svneol=native#text/plain
*.mak text svneol=native#text/plain
*.qbk text svneol=native#text/plain
*.rst text svneol=native#text/plain
*.sql text svneol=native#text/x-sql
*.txt text svneol=native#text/plain
*.xhtml text svneol=native#text/xhtml%2Bxml
*.xml text svneol=native#text/xml
*.xsd text svneol=native#text/xml
*.xsl text svneol=native#text/xml
*.xslt text svneol=native#text/xml
*.xul text svneol=native#text/xul
*.yml text svneol=native#text/plain
boost-no-inspect text svneol=native#text/plain
CHANGES text svneol=native#text/plain
COPYING text svneol=native#text/plain
INSTALL text svneol=native#text/plain
Jamfile text svneol=native#text/plain
Jamroot text svneol=native#text/plain
Jamfile.v2 text svneol=native#text/plain
Jamrules text svneol=native#text/plain
Makefile* text svneol=native#text/plain
README text svneol=native#text/plain
TODO text svneol=native#text/plain
# Code formats
*.c text svneol=native#text/plain
*.cpp text svneol=native#text/plain
*.h text svneol=native#text/plain
*.hpp text svneol=native#text/plain
*.ipp text svneol=native#text/plain
*.tpp text svneol=native#text/plain
*.jam text svneol=native#text/plain
*.java text svneol=native#text/plain

View File

@ -0,0 +1,868 @@
//
//=======================================================================
// Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
//
// This file is part of the Generic Graph Component Library
//
// You should have received a copy of the License Agreement for the
// Generic Graph Component Library along with the software; see the
// file LICENSE. If not, contact Office of Research, University of Notre
// Dame, Notre Dame, IN 46556.
//
// Permission to modify the code and to distribute modified code is
// granted, provided the text of this NOTICE is retained, a notice that
// the code was modified is included with the above COPYRIGHT NOTICE and
// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE
// file is distributed with the modified code.
//
// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
// By way of example, but not limitation, Licensor MAKES NO
// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS
// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS
// OR OTHER RIGHTS.
//=======================================================================
//
#ifndef BOOST_GRAPH_DETAIL_CONCEPT_CHECKS_HPP
#define BOOST_GRAPH_DETAIL_CONCEPT_CHECKS_HPP
#include <iterator>
#include <utility>
#include <boost/config.hpp>
#if defined(__GNUC__) || defined(__KCC)
#define _FPTR &
#else
#define _FPTR
#endif
#define REQUIRE(__type_var, __concept) \
do { \
void (__concept##_concept <__type_var>::*__x)() = \
_FPTR __concept##_concept <__type_var>::constraints; \
__x = __x; } while (0)
#define REQUIRE2(__type_var1, __type_var2, __concept) \
do { \
void (__concept##_concept <__type_var1, __type_var2>::*__x)() = \
_FPTR __concept##_concept <__type_var1, __type_var2>::constraints; \
__x = __x; } while (0)
#define REQUIRE3(__type_var1, __type_var2, __type_var3,__concept) \
do { \
void (__concept##_concept <__type_var1, __type_var2, __type_var3>::*__x)() = \
_FPTR __concept##_concept <__type_var1, __type_var2, __type_var3>::constraints; \
__x = __x; } while (0)
#define REQUIRE4(__type_var1, __type_var2, __type_var3,__type_var4,__concept) \
do { \
void (__concept##_concept <__type_var1,__type_var2,__type_var3,__type_var4>::*__x)() = \
_FPTR __concept##_concept <__type_var1, __type_var2, __type_var3, __type_var4>::constraints;\
__x = __x; } while (0)
#define CLASS_REQUIRES(__tv, __concept) \
typedef void (__concept##_concept <__tv>::* __func##__tv##__concept)(); \
template <__func##__tv##__concept _Tp1> \
struct __dummy_struct_##__tv##__concept { }; \
static __dummy_struct_##__tv##__concept< \
_FPTR __concept##_concept <__tv>::constraints> \
__dummy_ptr_##__tv##__concept
#define CLASS_REQUIRES2(__tv1, __tv2, __concept) \
typedef void (__concept##_concept <__tv1,__tv2>::* __func##__tv1##__tv2##__concept)(); \
template <__func##__tv1##__tv2##__concept _Tp1> \
struct __dummy_struct_##__tv1##__tv2##__concept { }; \
static __dummy_struct_##__tv1##__tv2##__concept< \
_FPTR __concept##_concept <__tv1,__tv2>::constraints> \
__dummy_ptr_##__tv1##__tv2##__concept
#define CLASS_REQUIRES3(__tv1, __tv2, __tv3, __concept) \
typedef void (__concept##_concept <__tv1,__tv2,__tv3>::* __func##__tv1##__tv2##__tv3##__concept)(); \
template <__func##__tv1##__tv2##__tv3##__concept _Tp1> \
struct __dummy_struct_##__tv1##__tv2##__tv3##__concept { }; \
static __dummy_struct_##__tv1##__tv2##__tv3##__concept< \
_FPTR __concept##_concept <__tv1,__tv2,__tv3>::constraints> \
__dummy_ptr_##__tv1##__tv2##__tv3##__concept
#define CLASS_REQUIRES4(__tv1, __tv2, __tv3, __tv4, __concept) \
typedef void (__concept##_concept <__tv1,__tv2,__tv3,__tv4>::* __func##__tv1##__tv2##__tv3##__tv4##__concept)(); \
template <__func##__tv1##__tv2##__tv3##__tv4##__concept _Tp1> \
struct __dummy_struct_##__tv1##__tv2##__tv3##__tv4##__concept { }; \
static __dummy_struct_##__tv1##__tv2##__tv3##__tv4##__concept< \
_FPTR __concept##_concept <__tv1,__tv2,__tv3,__tv4>::constraints> \
__dummy_ptr_##__tv1##__tv2##__tv3##__tv4##__concept
#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class T, class U>
struct require_same_type { };
template <class T>
struct require_same_type<T,T> { typedef T type; };
#else
template <class T, class U>
struct require_same_type { typedef T type; };
#endif
#define REQUIRE_SAME_TYPE(X,Y) \
typedef typename require_same_type<X,Y>::type X##_same_##Y
#define CLASS_REQUIRES_SAME_TYPE(X,Y) \
typedef typename require_same_type<X,Y>::type X##_same_##Y
template <class T> void ignore_unused_variable_warning(const T&) { }
template <class T>
struct Integer_concept {
void constraints() {
#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
error_the_type_must_be_an_integer_type();
#endif
}
};
#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <> struct Integer_concept<short> { void constraints() {} };
template <> struct Integer_concept<unsigned short> { void constraints() {} };
template <> struct Integer_concept<int> { void constraints() {} };
template <> struct Integer_concept<unsigned int> { void constraints() {} };
template <> struct Integer_concept<long> { void constraints() {} };
template <> struct Integer_concept<unsigned long> { void constraints() {} };
// etc.
#endif
//===========================================================================
// Basic Concepts
template <class X, class Y>
struct Convertible_concept
{
void constraints() {
Y y = x;
ignore_unused_variable_warning(y);
}
X x;
};
template <class TT>
struct Assignable_concept
{
void constraints() {
#if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL
a = a; // require assignment operator
#endif
TT c(a); // require copy constructor
const_constraints(a);
ignore_unused_variable_warning(c);
}
void const_constraints(const TT& b) {
#if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL
a = b; // const required for argument to assignment
#endif
TT c(b); // const required for argument to copy constructor
ignore_unused_variable_warning(c);
}
TT a;
};
template <class TT>
struct DefaultConstructible_concept
{
void constraints() {
TT a; // require default constructor
ignore_unused_variable_warning(a);
}
};
template <class T>
struct CopyConstructible_concept
{
void constraints() {
T a(b); // require copy constructor
T* ptr = &a; // require address of operator
const_constraints(a);
}
void const_constraints(const T& a) {
T c(a); // require const copy constructor
const T* ptr = &a; // require const address of operator
}
T b;
};
template <class TT>
struct EqualityComparable_concept
{
void constraints() {
r = a == b; // require equality operator
r = a != b; // require inequality operator
}
TT a, b;
bool r;
};
template <class TT>
struct LessThanComparable_concept
{
void constraints() {
// require comparison operators
r = a < b || a > b || a <= b || a >= b;
}
TT a, b;
bool r;
};
//===========================================================================
// Iterator Concepts
template <class TT>
struct TrivialIterator_concept
{
void constraints() {
REQUIRE(TT, Assignable);
REQUIRE(TT, DefaultConstructible);
REQUIRE(TT, EqualityComparable);
#ifndef BOOST_NO_STD_ITERATOR_TRAITS
typedef typename std::iterator_traits<TT>::value_type V;
#endif
(void)*i; // require dereference operator
}
TT i;
};
template <class TT>
struct Mutable_TrivialIterator_concept
{
void constraints() {
REQUIRE(TT, TrivialIterator);
*i = *j; // require dereference and assignment
}
TT i, j;
};
template <class TT>
struct InputIterator_concept
{
void constraints() {
REQUIRE(TT, TrivialIterator);
// require iterator_traits typedef's
#ifndef BOOST_NO_STD_ITERATOR_TRAITS
typedef typename std::iterator_traits<TT>::difference_type D;
typedef typename std::iterator_traits<TT>::reference R;
typedef typename std::iterator_traits<TT>::pointer P;
typedef typename std::iterator_traits<TT>::iterator_category C;
REQUIRE2(typename std::iterator_traits<TT>::iterator_category,
std::input_iterator_tag, Convertible);
#endif
++i; // require preincrement operator
i++; // require postincrement operator
}
TT i;
};
template <class TT, class ValueT>
struct OutputIterator_concept
{
void constraints() {
REQUIRE(TT, Assignable);
++i; // require preincrement operator
i++; // require postincrement operator
*i++ = t; // require postincrement and assignment
}
TT i, j;
ValueT t;
};
template <class TT>
struct ForwardIterator_concept
{
void constraints() {
REQUIRE(TT, InputIterator);
#ifndef BOOST_NO_STD_ITERATOR_TRAITS
REQUIRE2(typename std::iterator_traits<TT>::iterator_category,
std::forward_iterator_tag, Convertible);
typedef typename std::iterator_traits<TT>::reference reference;
reference r = *i;
ignore_unused_variable_warning(r);
#endif
}
TT i;
};
template <class TT>
struct Mutable_ForwardIterator_concept
{
void constraints() {
REQUIRE(TT, ForwardIterator);
*i++ = *i; // require postincrement and assignment
}
TT i;
};
template <class TT>
struct BidirectionalIterator_concept
{
void constraints() {
REQUIRE(TT, ForwardIterator);
#ifndef BOOST_NO_STD_ITERATOR_TRAITS
REQUIRE2(typename std::iterator_traits<TT>::iterator_category,
std::bidirectional_iterator_tag, Convertible);
#endif
--i; // require predecrement operator
i--; // require postdecrement operator
}
TT i;
};
template <class TT>
struct Mutable_BidirectionalIterator_concept
{
void constraints() {
REQUIRE(TT, BidirectionalIterator);
REQUIRE(TT, Mutable_ForwardIterator);
*i-- = *i; // require postdecrement and assignment
}
TT i;
};
template <class TT>
struct RandomAccessIterator_concept
{
void constraints() {
REQUIRE(TT, BidirectionalIterator);
REQUIRE(TT, LessThanComparable);
#ifndef BOOST_NO_STD_ITERATOR_TRAITS
REQUIRE2(typename std::iterator_traits<TT>::iterator_category,
std::random_access_iterator_tag, Convertible);
typedef typename std::iterator_traits<TT>::reference R;
#endif
i += n; // require assignment addition operator
i = i + n; i = n + i; // require addition with difference type
i -= n; // require assignment subtraction operator
i = i - n; // require subtraction with difference type
n = i - j; // require difference operator
(void)i[n]; // require element access operator
}
TT a, b;
TT i, j;
#ifndef BOOST_NO_STD_ITERATOR_TRAITS
typename std::iterator_traits<TT>::difference_type n;
#else
std::ptrdiff_t n;
#endif
};
template <class TT>
struct Mutable_RandomAccessIterator_concept
{
void constraints() {
REQUIRE(TT, RandomAccessIterator);
REQUIRE(TT, Mutable_BidirectionalIterator);
i[n] = *i; // require element access and assignment
}
TT i;
#ifndef BOOST_NO_STD_ITERATOR_TRAITS
typename std::iterator_traits<TT>::difference_type n;
#else
std::ptrdiff_t n;
#endif
};
//===========================================================================
// Function Object Concepts
template <class _Func, class _Ret>
struct Generator_concept
{
void constraints() {
__r = __f(); // require operator() member function
}
_Func __f;
_Ret __r;
};
#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class _Func>
struct Generator_concept<_Func,void>
{
void constraints() {
__f(); // require operator() member function
}
_Func __f;
};
#endif
template <class _Func, class _Ret, class _Arg>
struct UnaryFunction_concept
{
void constraints() {
__r = __f(__arg); // require operator()
}
_Func __f;
_Arg __arg;
_Ret __r;
};
#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class _Func, class _Arg>
struct UnaryFunction_concept<_Func,void,_Arg> {
void constraints() {
__f(__arg); // require operator()
}
_Func __f;
};
#endif
template <class _Func, class _Ret, class _First, class _Second>
struct BinaryFunction_concept
{
void constraints() {
__r = __f(__first, __second); // require operator()
}
_Func __f;
_First __first;
_Second __second;
_Ret __r;
};
#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class _Func, class _First, class _Second>
struct BinaryFunction_concept<_Func,void,_First,_Second>
{
void constraints() {
__f(__first, __second); // require operator()
}
_Func __f;
_First __first;
_Second __second;
};
#endif
template <class _Func, class _Arg>
struct UnaryPredicate_concept
{
void constraints() {
__r = __f(__arg); // require operator() returning bool
}
_Func __f;
_Arg __arg;
bool __r;
};
template <class _Func, class _First, class _Second>
struct BinaryPredicate_concept
{
void constraints() {
__r = __f(__a, __b); // require operator() returning bool
}
_Func __f;
_First __a;
_Second __b;
bool __r;
};
// use this when functor is used inside a container class like std::set
template <class _Func, class _First, class _Second>
struct Const_BinaryPredicate_concept {
void constraints() {
REQUIRE3(_Func,_First,_Second, BinaryPredicate);
bool __r = __f(__a,__b); // operator() must be a const member function
}
_Func __f;
_First __a;
_Second __b;
};
#define __STL_DEFINE_BINARY_OPERATOR_CONSTRAINT(_OP,_NAME) \
template <class _Ret, class _First, class _Second> \
struct _NAME##_concept { \
void constraints() { (void)_constraints(); } \
_Ret _constraints() { \
return __a _OP __b; \
} \
_First __a; \
_Second __b; \
}
__STL_DEFINE_BINARY_OPERATOR_CONSTRAINT(==, _OP_EQUAL);
__STL_DEFINE_BINARY_OPERATOR_CONSTRAINT(!=, _OP_NOT_EQUAL);
__STL_DEFINE_BINARY_OPERATOR_CONSTRAINT(<, _OP_LESS_THAN);
__STL_DEFINE_BINARY_OPERATOR_CONSTRAINT(<=, _OP_LESS_EQUAL);
__STL_DEFINE_BINARY_OPERATOR_CONSTRAINT(>, _OP_GREATER_THAN);
__STL_DEFINE_BINARY_OPERATOR_CONSTRAINT(>=, _OP_GREATER_EQUAL);
__STL_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, _OP_PLUS);
__STL_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, _OP_TIMES);
__STL_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, _OP_DIVIDE);
__STL_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, _OP_SUBTRACT);
__STL_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, _OP_MOD);
//===========================================================================
// Container Concepts
template <class Container>
struct Container_concept
{
typedef typename Container::value_type value_type;
typedef typename Container::difference_type difference_type;
typedef typename Container::size_type size_type;
typedef typename Container::const_reference const_reference;
typedef typename Container::const_pointer const_pointer;
typedef typename Container::const_iterator const_iterator;
void constraints() {
REQUIRE(const_iterator, InputIterator);
REQUIRE(Container, Assignable);
const Container c;
i = c.begin();
i = c.end();
n = c.size();
n = c.max_size();
b = c.empty();
}
bool b;
const_iterator i;
size_type n;
};
template <class Container>
struct Mutable_Container_concept
{
typedef typename Container::value_type value_type;
typedef typename Container::reference reference;
typedef typename Container::iterator iterator;
typedef typename Container::pointer pointer;
void constraints() {
REQUIRE(Container, Container);
REQUIRE(value_type, Assignable);
REQUIRE(iterator, InputIterator);
i = c.begin();
i = c.end();
c.swap(c2);
}
iterator i;
Container c, c2;
};
template <class ForwardContainer>
struct ForwardContainer_concept
{
void constraints() {
REQUIRE(ForwardContainer, Container);
typedef typename ForwardContainer::const_iterator const_iterator;
REQUIRE(const_iterator, ForwardIterator);
}
};
template <class ForwardContainer>
struct Mutable_ForwardContainer_concept
{
void constraints() {
REQUIRE(ForwardContainer, ForwardContainer);
REQUIRE(ForwardContainer, Mutable_Container);
typedef typename ForwardContainer::iterator iterator;
REQUIRE(iterator, Mutable_ForwardIterator);
}
};
template <class ReversibleContainer>
struct ReversibleContainer_concept
{
typedef typename ReversibleContainer::const_iterator const_iterator;
typedef typename ReversibleContainer::const_reverse_iterator
const_reverse_iterator;
void constraints() {
REQUIRE(ReversibleContainer, ForwardContainer);
REQUIRE(const_iterator, BidirectionalIterator);
REQUIRE(const_reverse_iterator, BidirectionalIterator);
const ReversibleContainer c;
const_reverse_iterator i = c.rbegin();
i = c.rend();
}
};
template <class ReversibleContainer>
struct Mutable_ReversibleContainer_concept
{
typedef typename ReversibleContainer::iterator iterator;
typedef typename ReversibleContainer::reverse_iterator reverse_iterator;
void constraints() {
REQUIRE(ReversibleContainer, ReversibleContainer);
REQUIRE(ReversibleContainer, Mutable_ForwardContainer);
REQUIRE(iterator, Mutable_BidirectionalIterator);
REQUIRE(reverse_iterator, Mutable_BidirectionalIterator);
reverse_iterator i = c.rbegin();
i = c.rend();
}
ReversibleContainer c;
};
template <class RandomAccessContainer>
struct RandomAccessContainer_concept
{
typedef typename RandomAccessContainer::size_type size_type;
typedef typename RandomAccessContainer::const_reference const_reference;
typedef typename RandomAccessContainer::const_iterator const_iterator;
typedef typename RandomAccessContainer::const_reverse_iterator
const_reverse_iterator;
void constraints() {
REQUIRE(RandomAccessContainer, ReversibleContainer);
REQUIRE(const_iterator, RandomAccessIterator);
REQUIRE(const_reverse_iterator, RandomAccessIterator);
const RandomAccessContainer c;
const_reference r = c[n];
ignore_unused_variable_warning(r);
}
size_type n;
};
template <class RandomAccessContainer>
struct Mutable_RandomAccessContainer_concept
{
typedef typename RandomAccessContainer::size_type size_type;
typedef typename RandomAccessContainer::reference reference;
typedef typename RandomAccessContainer::iterator iterator;
typedef typename RandomAccessContainer::reverse_iterator reverse_iterator;
void constraints() {
REQUIRE(RandomAccessContainer, RandomAccessContainer);
REQUIRE(RandomAccessContainer, Mutable_ReversibleContainer);
REQUIRE(iterator, Mutable_RandomAccessIterator);
REQUIRE(reverse_iterator, Mutable_RandomAccessIterator);
reference r = c[i];
ignore_unused_variable_warning(r);
}
size_type i;
RandomAccessContainer c;
};
// A Sequence is inherently mutable
template <class Sequence>
struct Sequence_concept
{
// Matt put's DefaultConstructible here, the C++ standard
// places it in Container
// CLASS_REQUIRES(Sequence, DefaultConstructible);
typedef typename Sequence::reference reference;
typedef typename Sequence::const_reference const_reference;
void constraints() {
REQUIRE(Sequence, Mutable_ForwardContainer);
REQUIRE(Sequence, DefaultConstructible);
Sequence
c(n),
c2(n, t),
c3(first, last);
c.insert(p, t);
c.insert(p, n, t);
c.insert(p, first, last);
c.erase(p);
c.erase(p, q);
reference r = c.front();
ignore_unused_variable_warning(c);
ignore_unused_variable_warning(c2);
ignore_unused_variable_warning(c3);
ignore_unused_variable_warning(r);
const_constraints(c);
}
void const_constraints(const Sequence& c) {
const_reference r = c.front();
ignore_unused_variable_warning(r);
}
typename Sequence::value_type t;
typename Sequence::size_type n;
typename Sequence::value_type* first, *last;
typename Sequence::iterator p, q;
};
template <class FrontInsertionSequence>
struct FrontInsertionSequence_concept
{
void constraints() {
REQUIRE(FrontInsertionSequence, Sequence);
c.push_front(t);
c.pop_front();
}
FrontInsertionSequence c;
typename FrontInsertionSequence::value_type t;
};
template <class BackInsertionSequence>
struct BackInsertionSequence_concept
{
typedef typename BackInsertionSequence::reference reference;
typedef typename BackInsertionSequence::const_reference const_reference;
void constraints() {
REQUIRE(BackInsertionSequence, Sequence);
c.push_back(t);
c.pop_back();
reference r = c.back();
ignore_unused_variable_warning(r);
}
void const_constraints(const BackInsertionSequence& c) {
const_reference r = c.back();
ignore_unused_variable_warning(r);
};
BackInsertionSequence c;
typename BackInsertionSequence::value_type t;
};
template <class AssociativeContainer>
struct AssociativeContainer_concept
{
void constraints() {
REQUIRE(AssociativeContainer, ForwardContainer);
REQUIRE(AssociativeContainer, DefaultConstructible);
i = c.find(k);
r = c.equal_range(k);
c.erase(k);
c.erase(i);
c.erase(r.first, r.second);
const_constraints(c);
}
void const_constraints(const AssociativeContainer& c) {
ci = c.find(k);
n = c.count(k);
cr = c.equal_range(k);
}
typedef typename AssociativeContainer::iterator iterator;
typedef typename AssociativeContainer::const_iterator const_iterator;
AssociativeContainer c;
iterator i;
std::pair<iterator,iterator> r;
const_iterator ci;
std::pair<const_iterator,const_iterator> cr;
typename AssociativeContainer::key_type k;
typename AssociativeContainer::size_type n;
};
template <class UniqueAssociativeContainer>
struct UniqueAssociativeContainer_concept
{
void constraints() {
REQUIRE(UniqueAssociativeContainer, AssociativeContainer);
UniqueAssociativeContainer c(first, last);
pos_flag = c.insert(t);
c.insert(first, last);
ignore_unused_variable_warning(c);
}
std::pair<typename UniqueAssociativeContainer::iterator, bool> pos_flag;
typename UniqueAssociativeContainer::value_type t;
typename UniqueAssociativeContainer::value_type* first, *last;
};
template <class MultipleAssociativeContainer>
struct MultipleAssociativeContainer_concept
{
void constraints() {
REQUIRE(MultipleAssociativeContainer, AssociativeContainer);
MultipleAssociativeContainer c(first, last);
pos = c.insert(t);
c.insert(first, last);
ignore_unused_variable_warning(c);
ignore_unused_variable_warning(pos);
}
typename MultipleAssociativeContainer::iterator pos;
typename MultipleAssociativeContainer::value_type t;
typename MultipleAssociativeContainer::value_type* first, *last;
};
template <class SimpleAssociativeContainer>
struct SimpleAssociativeContainer_concept
{
void constraints() {
REQUIRE(SimpleAssociativeContainer, AssociativeContainer);
typedef typename SimpleAssociativeContainer::key_type key_type;
typedef typename SimpleAssociativeContainer::value_type value_type;
CLASS_REQUIRES_SAME_TYPE(key_type, value_type);
}
};
template <class SimpleAssociativeContainer>
struct PairAssociativeContainer_concept
{
void constraints() {
REQUIRE(SimpleAssociativeContainer, AssociativeContainer);
typedef typename SimpleAssociativeContainer::key_type key_type;
typedef typename SimpleAssociativeContainer::value_type value_type;
typedef typename SimpleAssociativeContainer::mapped_type mapped_type;
typedef std::pair<const key_type, mapped_type> required_value_type;
CLASS_REQUIRES_SAME_TYPE(value_type, required_value_type);
}
};
template <class SortedAssociativeContainer>
struct SortedAssociativeContainer_concept
{
void constraints() {
REQUIRE(SortedAssociativeContainer, AssociativeContainer);
REQUIRE(SortedAssociativeContainer, ReversibleContainer);
SortedAssociativeContainer
c(kc),
c2(first, last),
c3(first, last, kc);
p = c.upper_bound(k);
p = c.lower_bound(k);
r = c.equal_range(k);
c.insert(p, t);
ignore_unused_variable_warning(c);
ignore_unused_variable_warning(c2);
ignore_unused_variable_warning(c3);
}
void const_constraints(const SortedAssociativeContainer& c) {
kc = c.key_comp();
vc = c.value_comp();
cp = c.upper_bound(k);
cp = c.lower_bound(k);
cr = c.equal_range(k);
}
typename SortedAssociativeContainer::key_compare kc;
typename SortedAssociativeContainer::value_compare vc;
typename SortedAssociativeContainer::value_type t;
typename SortedAssociativeContainer::key_type k;
typedef typename SortedAssociativeContainer::iterator iterator;
typedef typename SortedAssociativeContainer::const_iterator const_iterator;
iterator p;
const_iterator cp;
std::pair<iterator,iterator> r;
std::pair<const_iterator,const_iterator> cr;
typename SortedAssociativeContainer::value_type* first, *last;
};
// HashedAssociativeContainer
#endif /* BOOST_GRAPH_DETAIL_CONCEPT_CHECKS_H */

View File

@ -0,0 +1,153 @@
// $COPYRIGHT
#ifndef BOOST_CONCEPT_SKELETONS_HPP
#define BOOST_CONCEPT_SKELETONS_HPP
#include <iterator>
namespace boost {
template <class T>
struct input_proxy {
operator const T&() { return t; }
static T t;
};
template <class T>
class trivial_iterator_skeleton
{
typedef trivial_iterator_skeleton self;
public:
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
typedef T value_type;
typedef void reference;
typedef void pointer;
typedef void difference_type;
typedef void iterator_category;
#endif
trivial_iterator_skeleton() { }
self& operator=(const self&) { return *this; }
bool operator==(const self&) const { return true; }
bool operator!=(const self&) const { return true; }
input_proxy<T> operator*() { return input_proxy<T>(); }
};
}
#ifndef BOOST_O_TEMPLATE_PARTIAL_SPECIALIZATION
namespace std {
template <class T>
struct iterator_traits< boost::trivial_iterator_skeleton<T> >
{
typedef T value_type;
};
}
#endif
namespace boost {
template <class T>
struct input_output_proxy {
input_output_proxy<T>& operator=(const T&) { return *this; }
operator T() { return t; }
T t;
};
template <class T>
class mutable_trivial_iterator_skeleton
{
typedef mutable_trivial_iterator_skeleton self;
public:
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
typedef T value_type;
typedef void reference;
typedef void pointer;
typedef void difference_type;
typedef void iterator_category;
#endif
mutable_trivial_iterator_skeleton() { }
self& operator=(const self&) { return *this; }
bool operator==(const self&) const { return true; }
bool operator!=(const self&) const { return true; }
input_output_proxy<T> operator*() { return input_output_proxy<T>(); }
T x;
};
}
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
namespace std {
template <class T>
struct iterator_traits< boost::mutable_trivial_iterator_skeleton<T> >
{
typedef T value_type;
};
}
#endif
namespace boost {
template <class T>
class input_iterator_skeleton
{
public:
typedef input_iterator_skeleton self;
public:
typedef std::input_iterator_tag iterator_category;
typedef T value_type;
typedef const T& reference;
typedef const T* pointer;
typedef void difference_type;
input_iterator_skeleton() { }
self& operator=(const self&) { return *this; }
bool operator==(const self&) const { return true; }
bool operator!=(const self&) const { return true; }
reference operator*() { return x; }
self& operator++() { return *this; }
self operator++(int) { return *this; }
T x;
};
struct output_proxy {
template <class T>
output_proxy& operator=(const T&) { return *this; }
};
class output_iterator_skeleton
{
public:
typedef output_iterator_skeleton self;
public:
typedef std::output_iterator_tag iterator_category;
typedef output_proxy value_type;
typedef output_proxy reference;
typedef void pointer;
typedef void difference_type;
output_iterator_skeleton() { }
self& operator=(const self&) { return *this; }
bool operator==(const self&) const { return true; }
bool operator!=(const self&) const { return true; }
reference operator*() { return output_proxy(); }
self& operator++() { return *this; }
self operator++(int) { return *this; }
};
template <class T>
class forward_iterator_skeleton
{
public:
typedef forward_iterator_skeleton self;
public:
typedef std::forward_iterator_tag iterator_category;
typedef T value_type;
typedef T& reference;
typedef T* pointer;
typedef void difference_type;
forward_iterator_skeleton() { }
self& operator=(const self&) { return *this; }
bool operator==(const self&) const { return true; }
bool operator!=(const self&) const { return true; }
reference operator*() { return x; }
self& operator++() { return *this; }
self operator++(int) { return *this; }
T x;
};
} // namespace boost
#endif // BOOST_CONCEPT_SKELETONS_H