From 7c3a25a377c4b745905cc7d5ffff9956128e95ab Mon Sep 17 00:00:00 2001 From: Jeremy Siek Date: Sun, 3 Dec 2000 06:20:23 +0000 Subject: [PATCH] various changes, almost forgot to check in [SVN r8379] --- CopyConstructible.html | 22 ++++++++++++++++++++++ iterator_adaptor_examples.cpp | 4 +++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CopyConstructible.html b/CopyConstructible.html index 8629642..4134f5e 100644 --- a/CopyConstructible.html +++ b/CopyConstructible.html @@ -170,6 +170,28 @@ denotes the address of u
  • std::pair +

    Concept Checking Class

    + +
    +  template <class T>
    +  struct CopyConstructibleConcept
    +  {
    +    void constraints() {
    +      T a(b);            // require copy constructor
    +      T* ptr = &a;       // require address of operator
    +      const_constraints(a);
    +      ignore_unused_variable_warning(ptr);
    +    }
    +    void const_constraints(const T& a) {
    +      T c(a);            // require const copy constructor
    +      const T* ptr = &a; // require const address of operator
    +      ignore_unused_variable_warning(c);
    +      ignore_unused_variable_warning(ptr);
    +    }
    +    T b;
    +  };
    +
    +

    See also

    DefaultConstructible diff --git a/iterator_adaptor_examples.cpp b/iterator_adaptor_examples.cpp index aa0affb..c7baa08 100644 --- a/iterator_adaptor_examples.cpp +++ b/iterator_adaptor_examples.cpp @@ -7,7 +7,8 @@ #include #include #include -#include +#include +#include int main(int, char*[]) @@ -15,6 +16,7 @@ main(int, char*[]) // This is a simple example of using the transform_iterators class to // generate iterators that multiply the value returned by dereferencing // the iterator. In this case we are multiplying by 2. + // Would be cooler to use lambda library in this example. int x[] = { 1, 2, 3, 4, 5, 6, 7, 8 };