forked from boostorg/concept_check
lots off additions to docs and archetype stuff
[SVN r8063]
This commit is contained in:
11
bad_error_eg.cpp
Normal file
11
bad_error_eg.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <list>
|
||||
#include <algorithm>
|
||||
|
||||
struct foo {
|
||||
bool operator<(const foo&) const { return false; }
|
||||
};
|
||||
int main(int, char*[]) {
|
||||
std::list<foo> v;
|
||||
std::stable_sort(v.begin(), v.end());
|
||||
return 0;
|
||||
}
|
70
bibliography.html
Normal file
70
bibliography.html
Normal file
@@ -0,0 +1,70 @@
|
||||
<HTML>
|
||||
<!--
|
||||
-- Copyright (c) Jeremy Siek 2000
|
||||
--
|
||||
-- Permission to use, copy, modify, distribute and sell this software
|
||||
-- and its documentation for any purpose is hereby granted without fee,
|
||||
-- provided that the above copyright notice appears in all copies and
|
||||
-- that both that copyright notice and this permission notice appear
|
||||
-- in supporting documentation. Silicon Graphics makes no
|
||||
-- representations about the suitability of this software for any
|
||||
-- purpose. It is provided "as is" without express or implied warranty.
|
||||
-->
|
||||
<Head>
|
||||
<Title>Boost Graph Library: Bibliography</Title>
|
||||
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
|
||||
ALINK="#ff0000">
|
||||
<IMG SRC="../../c++boost.gif"
|
||||
ALT="C++ Boost" width="277" height="86">
|
||||
|
||||
<BR Clear>
|
||||
|
||||
|
||||
<H2>Bibliography</H2>
|
||||
|
||||
<DL COMMapCT>
|
||||
|
||||
<DD><P></P><DT><a name="alexandrescu99:_better_templ_error_messag">1</a>
|
||||
<DD>Andrei Alexandrescu<BR>
|
||||
<EM>Better Template Error Messages</EM>.<BR>
|
||||
C/C++ Users Journal, March, 1999.
|
||||
|
||||
|
||||
<DD><P></P><DT><a name="stroustrup94:_design_evolution">2</a>
|
||||
<DD>Bjarne Stroustrup<BR>
|
||||
<EM>Design and Evolution of C++</EM>.<BR>
|
||||
Addison-Wesley, 1994
|
||||
|
||||
<P></P><DT><A NAME="austern99:_gener_progr_stl">3</A>
|
||||
<DD>
|
||||
M. H. Austern.
|
||||
<BR><EM>Generic Programming and the STL</EM>.
|
||||
<BR>Professional computing series. Addison-Wesley, 1999.
|
||||
|
||||
<P></P><DT><A NAME="IB-H965502">4</A>
|
||||
<DD>
|
||||
David R. Musser and Atul Saini
|
||||
<BR><EM>STL Tutorial and Reference Guide</EM>.
|
||||
<BR>Professional computing series. Addison-Wesley, 1996.
|
||||
|
||||
<P></P><DT><A NAME="stepa.lee-1994:the.s:TR">5</A>
|
||||
<DD>
|
||||
A. A. Stepanov and M. Lee
|
||||
<BR><EM>The Standard Template Library</EM>.
|
||||
<BR>ISO Programming Language C++ Project, May 1994.
|
||||
<BR>X3J16/94-0095, WG21/N0482
|
||||
|
||||
|
||||
|
||||
</DL>
|
||||
|
||||
<br>
|
||||
<HR>
|
||||
<TABLE>
|
||||
<TR valign=top>
|
||||
<TD nowrap>Copyright © 2000</TD><TD>
|
||||
<A HREF=http://www.boost.org/people/jeremy_siek.htm>Jeremy Siek</A>, Univ.of Notre Dame (<A HREF="mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</A>)
|
||||
</TD></TR></TABLE>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
File diff suppressed because it is too large
Load Diff
@@ -1,29 +1,10 @@
|
||||
//=======================================================================
|
||||
// Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
|
||||
// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
|
||||
//
|
||||
// This file is part of the Boost Graph Library
|
||||
//
|
||||
// You should have received a copy of the License Agreement for the
|
||||
// Boost Graph 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.
|
||||
//=======================================================================
|
||||
// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify,
|
||||
// sell and distribute this software is granted provided this
|
||||
// copyright notice appears in all copies. This software is provided
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
|
||||
#include <boost/pending/concept_checks.hpp>
|
||||
#include <boost/pending/concept_skeletons.hpp>
|
||||
|
||||
#include <iterator>
|
||||
#include <set>
|
||||
@@ -38,11 +19,6 @@
|
||||
int
|
||||
main()
|
||||
{
|
||||
typedef boost::trivial_iterator_skeleton<int> TrivIterSkeleton;
|
||||
typedef boost::mutable_trivial_iterator_skeleton<int> MutTrivIterSkeleton;
|
||||
REQUIRE(TrivIterSkeleton, TrivialIterator);
|
||||
REQUIRE(MutTrivIterSkeleton, Mutable_TrivialIterator);
|
||||
|
||||
#if defined(_ITERATOR_)
|
||||
// VC++ STL implementation is not standard conformant and
|
||||
// fails to pass these concept checks
|
||||
|
256
stl_concept_covering.cpp
Normal file
256
stl_concept_covering.cpp
Normal file
@@ -0,0 +1,256 @@
|
||||
// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify,
|
||||
// sell and distribute this software is granted provided this
|
||||
// copyright notice appears in all copies. This software is provided
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
|
||||
#include <boost/pending/concept_checks.hpp>
|
||||
#include <boost/pending/concept_archetypes.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
/*
|
||||
|
||||
This file uses the archetype classes to verify whether the concept
|
||||
requirements documented for the STL algorithms actually *cover* the
|
||||
algorithms true requirements.
|
||||
|
||||
*/
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
//===========================================================================
|
||||
// First verify that the archetype classes model the concepts they
|
||||
// are suppose to.
|
||||
|
||||
{
|
||||
typedef unary_function_archetype<int, int> F;
|
||||
REQUIRE3(F, int, int, UnaryFunction);
|
||||
}
|
||||
{
|
||||
typedef binary_function_archetype<int, int, int> F;
|
||||
REQUIRE4(F, int, int, int, BinaryFunction);
|
||||
}
|
||||
{
|
||||
typedef unary_predicate_archetype<int> F;
|
||||
REQUIRE2(F, int, UnaryPredicate);
|
||||
}
|
||||
{
|
||||
typedef binary_predicate_archetype<int, int> F;
|
||||
REQUIRE3(F, int, int, BinaryPredicate);
|
||||
}
|
||||
{
|
||||
typedef input_iterator_archetype<null_archetype> Iter;
|
||||
REQUIRE(Iter, InputIterator);
|
||||
}
|
||||
{
|
||||
typedef output_iterator_archetype Iter;
|
||||
REQUIRE2(Iter, int, OutputIterator);
|
||||
}
|
||||
{
|
||||
typedef forward_iterator_archetype<null_archetype> Iter;
|
||||
REQUIRE(Iter, ForwardIterator);
|
||||
}
|
||||
{
|
||||
typedef bidirectional_iterator_archetype<null_archetype> Iter;
|
||||
REQUIRE(Iter, BidirectionalIterator);
|
||||
}
|
||||
{
|
||||
typedef random_access_iterator_archetype<null_archetype> Iter;
|
||||
REQUIRE(Iter, RandomAccessIterator);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Non-mutating Algorithms
|
||||
{
|
||||
input_iterator_archetype< convertible_to_archetype< null_archetype > > in;
|
||||
unary_function_archetype< null_archetype, null_archetype> f;
|
||||
std::for_each(in, in, f);
|
||||
}
|
||||
{
|
||||
/*
|
||||
SGI STL Docs and the C++ standard (25.1.2) requirements for
|
||||
std::for_each() are broken. They should be specified as follows:
|
||||
|
||||
template <class InputIterator, class LeftEqualityComparable>
|
||||
InputIterator find(InputIterator first, InputIterator last,
|
||||
const LeftEqualityComparable& value)
|
||||
{
|
||||
REQUIRE(InputIterator, InputIterator);
|
||||
typedef typename std::iterator_traits<InputIterator>::value_type
|
||||
value_type;
|
||||
REQUIRE(LeftEqualityComparable, value_type, LeftEqualityComparable);
|
||||
...
|
||||
}
|
||||
*/
|
||||
input_iterator_archetype< null_archetype > in;
|
||||
left_equality_comparable_archetype< null_archetype > value(dummy_cons);
|
||||
in = std::find(in, in, value);
|
||||
}
|
||||
{
|
||||
input_iterator_archetype< convertible_to_archetype< null_archetype > > in;
|
||||
unary_predicate_archetype< null_archetype > pred;
|
||||
in = std::find_if(in, in, pred);
|
||||
}
|
||||
{
|
||||
forward_iterator_archetype< equality_comparable_archetype<> > fo;
|
||||
fo = std::adjacent_find(fo, fo);
|
||||
}
|
||||
{
|
||||
forward_iterator_archetype< convertible_to_archetype< null_archetype > > fo;
|
||||
binary_predicate_archetype<null_archetype, null_archetype> pred;
|
||||
fo = std::adjacent_find(fo, fo, pred);
|
||||
}
|
||||
{
|
||||
/* SGI STL documentation is wrong. The value type of the
|
||||
input iterator does not need to be equality comparable.
|
||||
*/
|
||||
input_iterator_archetype<null_archetype> in;
|
||||
typedef left_equality_comparable_archetype<null_archetype> Right;
|
||||
forward_iterator_archetype<Right> fo;
|
||||
in = std::find_first_of(in, in, fo, fo);
|
||||
}
|
||||
{
|
||||
typedef input_iterator_archetype<null_archetype> InIter;
|
||||
InIter in;
|
||||
REQUIRE(InIter, InputIterator);
|
||||
left_equality_comparable_archetype<null_archetype> value(dummy_cons);
|
||||
std::iterator_traits<InIter>::difference_type
|
||||
n = std::count(in, in, value);
|
||||
}
|
||||
{
|
||||
typedef input_iterator_archetype<null_archetype> InIter;
|
||||
InIter in;
|
||||
left_equality_comparable_archetype<null_archetype> value(dummy_cons);
|
||||
unsigned long n;
|
||||
std::count(in, in, value, n);
|
||||
}
|
||||
{
|
||||
typedef input_iterator_archetype< convertible_to_archetype<null_archetype> > InIter;
|
||||
InIter in;
|
||||
unary_predicate_archetype<null_archetype> pred;
|
||||
std::iterator_traits<InIter>::difference_type
|
||||
n = std::count_if(in, in, pred);
|
||||
}
|
||||
{
|
||||
input_iterator_archetype< convertible_to_archetype<null_archetype> > in;
|
||||
unary_predicate_archetype<null_archetype> pred;
|
||||
unsigned long n;
|
||||
std::count_if(in, in, pred, n);
|
||||
}
|
||||
{
|
||||
/*
|
||||
SGI STL Documentation wrong. EqualityComparable not needed.
|
||||
*/
|
||||
typedef input_iterator_archetype<null_archetype> InIter1;
|
||||
InIter1 in1;
|
||||
typedef left_equality_comparable_archetype<null_archetype> Right;
|
||||
typedef input_iterator_archetype<Right> InIter2;
|
||||
InIter2 in2;
|
||||
std::pair<InIter1, InIter2> p = std::mismatch(in1, in1, in2);
|
||||
}
|
||||
{
|
||||
typedef input_iterator_archetype< convertible_to_archetype<null_archetype> > InIter;
|
||||
InIter in1, in2;
|
||||
binary_predicate_archetype<null_archetype, null_archetype> pred;
|
||||
std::pair<InIter, InIter> p = std::mismatch(in1, in1, in2, pred);
|
||||
}
|
||||
{
|
||||
// SGI STL docs: EqualityComparable not needed
|
||||
input_iterator_archetype<null_archetype> in1;
|
||||
typedef left_equality_comparable_archetype<null_archetype> Right;
|
||||
input_iterator_archetype<Right> in2;
|
||||
bool b = std::equal(in1, in1, in2);
|
||||
}
|
||||
{
|
||||
input_iterator_archetype< convertible_to_archetype<null_archetype> > in1, in2;
|
||||
binary_predicate_archetype<null_archetype, null_archetype> pred;
|
||||
bool b = std::equal(in1, in1, in2, pred);
|
||||
}
|
||||
{
|
||||
// SGI STL docs: EqualityComparable not needed
|
||||
forward_iterator_archetype<null_archetype> fo1;
|
||||
typedef left_equality_comparable_archetype<null_archetype> Right;
|
||||
forward_iterator_archetype<Right> fo2;
|
||||
fo1 = std::search(fo1, fo1, fo2, fo2);
|
||||
}
|
||||
{
|
||||
// SGI STL docs: LeftEqualityComparable missing
|
||||
// search() calls find()
|
||||
typedef convertible_to_archetype<null_archetype> Left;
|
||||
forward_iterator_archetype<Left> fo1;
|
||||
typedef convertible_to_archetype<null_archetype,
|
||||
left_equality_comparable_archetype<Left> > Right;
|
||||
forward_iterator_archetype<Right> fo2;
|
||||
binary_predicate_archetype<null_archetype, null_archetype> pred;
|
||||
fo1 = std::search(fo1, fo1, fo2, fo2, pred);
|
||||
}
|
||||
{
|
||||
// SGI STL docs: EqualityComparable not needed
|
||||
forward_iterator_archetype<null_archetype> fo;
|
||||
left_equality_comparable_archetype<null_archetype> value(dummy_cons);
|
||||
int n;
|
||||
fo = std::search_n(fo, fo, n, value);
|
||||
}
|
||||
{
|
||||
// SGI STL docs: EqualityComparable not needed
|
||||
forward_iterator_archetype< convertible_to_archetype<null_archetype> > fo;
|
||||
convertible_to_archetype<null_archetype> value(dummy_cons);
|
||||
binary_predicate_archetype<null_archetype, null_archetype> pred;
|
||||
int n;
|
||||
fo = std::search_n(fo, fo, n, value, pred);
|
||||
}
|
||||
{
|
||||
forward_iterator_archetype<null_archetype> fo1;
|
||||
typedef left_equality_comparable_archetype<null_archetype> Right;
|
||||
forward_iterator_archetype<Right> fo2;
|
||||
fo1 = std::find_end(fo1, fo1, fo2, fo2);
|
||||
}
|
||||
{
|
||||
// SGI STL docs: LeftEqualityComparable missing
|
||||
typedef convertible_to_archetype<null_archetype> Left;
|
||||
forward_iterator_archetype<Left> fo1;
|
||||
typedef convertible_to_archetype<null_archetype,
|
||||
left_equality_comparable_archetype<Left> > Right;
|
||||
forward_iterator_archetype<Right> fo2;
|
||||
binary_predicate_archetype<null_archetype, null_archetype> pred;
|
||||
fo1 = std::find_end(fo1, fo1, fo2, fo2, pred);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Mutating Algorithms
|
||||
|
||||
// UNDER CONSTRUCTION
|
||||
|
||||
{
|
||||
// SGI STL docs missing CopyConstructible and Assignable
|
||||
typedef equality_comparable_archetype< copy_constructible_archetype<
|
||||
assignable_archetype<> > > T;
|
||||
input_iterator_archetype<T> in;
|
||||
output_iterator_archetype out;
|
||||
out = std::unique_copy(in, in, out);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Sorting Algorithms
|
||||
|
||||
// UNDER CONSTRUCTION
|
||||
|
||||
{
|
||||
typedef less_than_comparable_archetype<
|
||||
copy_constructible_archetype<
|
||||
assignable_archetype<> > > ValueType;
|
||||
random_access_iterator_archetype<ValueType> ri;
|
||||
std::stable_sort(ri, ri);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Generalized Numeric Algorithms
|
||||
|
||||
// UNDER CONSTRUCTION
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user