From 37a85e9656da4e8261cc6074a6f3160ed021a764 Mon Sep 17 00:00:00 2001 From: "Troy D. Straszheim" Date: Tue, 26 May 2009 14:05:46 +0000 Subject: [PATCH] mergme [SVN r53280] --- compose.hpp.html | 459 -------------------------------------- compose.html | 148 ------------ compose1.cpp | 38 ---- compose1.cpp.html | 54 ----- compose2.cpp | 42 ---- compose2.cpp.html | 59 ----- compose3.cpp | 37 --- compose3.cpp.html | 54 ----- compose4.cpp | 37 --- compose4.cpp.html | 54 ----- include/boost/compose.hpp | 233 ------------------- index.html | 9 - print.hpp | 28 --- print.hpp.html | 45 ---- 14 files changed, 1297 deletions(-) delete mode 100644 compose.hpp.html delete mode 100644 compose.html delete mode 100644 compose1.cpp delete mode 100644 compose1.cpp.html delete mode 100644 compose2.cpp delete mode 100644 compose2.cpp.html delete mode 100644 compose3.cpp delete mode 100644 compose3.cpp.html delete mode 100644 compose4.cpp delete mode 100644 compose4.cpp.html delete mode 100644 include/boost/compose.hpp delete mode 100644 index.html delete mode 100644 print.hpp delete mode 100644 print.hpp.html diff --git a/compose.hpp.html b/compose.hpp.html deleted file mode 100644 index 76b30d4..0000000 --- a/compose.hpp.html +++ /dev/null @@ -1,459 +0,0 @@ - - -compose.hpp - - - -  - -
- - compose.hpp - -

- - - The following code example is taken from the book
- - The C++ Standard Library - A Tutorial and Reference
- by Nicolai M. Josuttis, Addison-Wesley, 1999
- - © Copyright Nicolai M. Josuttis 1999
-
- -

-/* supplementing compose function objects
* Son Dez 26 22:11:12 MET 1999
*/
-#ifndef BOOST_COMPOSE_HPP
-#define BOOST_COMPOSE_HPP
-
-#include <functional>
-
-namespace boost {
-
-/**********************************************************
* type nullary_function
* - as supplement to unary_function and binary_function
**********************************************************/
-template <class Result>
-struct nullary_function {
-    typedef Result result_type;
-};
-
-/**********************************************************
* ptr_fun for functions with no argument
**********************************************************/
-template <class Result>
-class pointer_to_nullary_function : public nullary_function<Result>
-{
-  protected:
-    Result (*ptr)();
-  public:
-    pointer_to_nullary_function() {
-    }
-    explicit pointer_to_nullary_function(Result (*x)()) : ptr(x) {
-    }
-    Result operator()() const { 
-        return ptr();
-    }
-};
-
-template <class Result>
-inline pointer_to_nullary_function<Result> ptr_fun(Result (*x)())
-{
-  return pointer_to_nullary_function<Result>(x);
-}
-
-/*********** compose_f_gx_t and compose_f_gx **********************/
-
-/* class for the compose_f_gx adapter
*/
-template <class OP1, class OP2>
-class compose_f_gx_t
- : public std::unary_function<typename OP2::argument_type,
-                              typename OP1::result_type>
-{
-  private:
-    OP1 op1;    // process: op1(op2(x))
-    OP2 op2;
-  public:
-    // constructor
-    compose_f_gx_t(const OP1& o1, const OP2& o2)
-     : op1(o1), op2(o2) {
-    }
-
-    // function call
-    typename OP1::result_type
-    operator()(const typename OP2::argument_type& x) const {
-        return op1(op2(x));
-    }
-};
-
-/* convenience functions for the compose_f_gx adapter
*/
-template <class OP1, class OP2>
-inline compose_f_gx_t<OP1,OP2>
-compose_f_gx (const OP1& o1, const OP2& o2) {
-    return compose_f_gx_t<OP1,OP2>(o1,o2);
-}
-
-/*********** compose_f_gx_hx_t and compose_f_gx_hx **********************/
-
-/* class for the compose_f_gx_hx adapter
*/
-template <class OP1, class OP2, class OP3>
-class compose_f_gx_hx_t
- : public std::unary_function<typename OP2::argument_type,
-                              typename OP1::result_type>
-{
-  private:
-    OP1 op1;    // process: op1(op2(x),op3(x))
-    OP2 op2;
-    OP3 op3;
-  public:
-    // constructor
-    compose_f_gx_hx_t (const OP1& o1, const OP2& o2, const OP3& o3)
-     : op1(o1), op2(o2), op3(o3) {
-    }
-
-    // function call
-    typename OP1::result_type
-    operator()(const typename OP2::argument_type& x) const {
-        return op1(op2(x),op3(x));
-    }
-};
-
-/* convenience functions for the compose_f_gx_hx adapter
*/
-template <class OP1, class OP2, class OP3>
-inline compose_f_gx_hx_t<OP1,OP2,OP3>
-compose_f_gx_hx (const OP1& o1, const OP2& o2, const OP3& o3) {
-    return compose_f_gx_hx_t<OP1,OP2,OP3>(o1,o2,o3);
-}
-
-/*********** compose_f_gxy_t and compose_f_gxy **********************/
-
-/* class for the compose_f_gxy adapter
*/
-template <class OP1, class OP2>
-class compose_f_gxy_t
- : public std::binary_function<typename OP2::first_argument_type,
-                               typename OP2::second_argument_type,
-                               typename OP1::result_type>
-{
-  private:
-    OP1 op1;    // process: op1(op2(x,y))
-    OP2 op2;
-  public:
-    // constructor
-    compose_f_gxy_t (const OP1& o1, const OP2& o2)
-     : op1(o1), op2(o2) {
-    }
-
-    // function call
-    typename OP1::result_type
-    operator()(const typename OP2::first_argument_type& x,
-               const typename OP2::second_argument_type& y) const {
-        return op1(op2(x,y));
-    }
-};
-
-/* convenience function for the compose_f_gxy adapter
*/
-template <class OP1, class OP2>
-inline compose_f_gxy_t<OP1,OP2>
-compose_f_gxy (const OP1& o1, const OP2& o2) {
-    return compose_f_gxy_t<OP1,OP2>(o1,o2);
-}
-
-/*********** compose_f_gx_hy_t and compose_f_gx_hy **********************/
-
-/* class for the compose_f_gx_hy adapter
*/
-template <class OP1, class OP2, class OP3>
-class compose_f_gx_hy_t
- : public std::binary_function<typename OP2::argument_type,
-                               typename OP3::argument_type,
-                               typename OP1::result_type>
-{
-  private:
-    OP1 op1;    // process: op1(op2(x),op3(y))
-    OP2 op2;
-    OP3 op3;
-  public:
-    // constructor
-    compose_f_gx_hy_t (const OP1& o1, const OP2& o2, const OP3& o3)
-     : op1(o1), op2(o2), op3(o3) {
-    }
-
-    // function call
-    typename OP1::result_type
-    operator()(const typename OP2::argument_type& x,
-               const typename OP3::argument_type& y) const {
-        return op1(op2(x),op3(y));
-    }
-};
-
-/* convenience function for the compose_f_gx_hy adapter
*/
-template <class OP1, class OP2, class OP3>
-inline compose_f_gx_hy_t<OP1,OP2,OP3>
-compose_f_gx_hy (const OP1& o1, const OP2& o2, const OP3& o3) {
-    return compose_f_gx_hy_t<OP1,OP2,OP3>(o1,o2,o3);
-}
-
-/*********** compose_f_g_t and compose_f_g **********************/
-
-/* class for the compose_f_g adapter
*/
-template <class OP1, class OP2>
-class compose_f_g_t
- : public boost::nullary_function<typename OP1::result_type>
-{
-  private:
-    OP1 op1;    // process: op1(op2())
-    OP2 op2;
-  public:
-    // constructor
-    compose_f_g_t(const OP1& o1, const OP2& o2)
-     : op1(o1), op2(o2) {
-    }
-
-    // function call
-    typename OP1::result_type
-    operator()() const {
-        return op1(op2());
-    }
-};
-
-/* convenience functions for the compose_f_g adapter
*/
-template <class OP1, class OP2>
-inline compose_f_g_t<OP1,OP2>
-compose_f_g (const OP1& o1, const OP2& o2) {
-    return compose_f_g_t<OP1,OP2>(o1,o2);
-}
-
-} /* namespace boost */
-
-#endif /*BOOST_COMPOSE_HPP*/
-/* supplementing compose function objects
* Son Dez 26 22:14:55 MET 1999
*/
-#ifndef BOOST_COMPOSE_HPP
-#define BOOST_COMPOSE_HPP
-
-#include <functional>
-
-namespace boost {
-
-/**********************************************************
* type nullary_function
* - as supplement to unary_function and binary_function
**********************************************************/
-template <class Result>
-struct nullary_function {
-    typedef Result result_type;
-};
-
-/**********************************************************
* ptr_fun for functions with no argument
**********************************************************/
-template <class Result>
-class pointer_to_nullary_function : public nullary_function<Result>
-{
-  protected:
-    Result (*ptr)();
-  public:
-    pointer_to_nullary_function() {
-    }
-    explicit pointer_to_nullary_function(Result (*x)()) : ptr(x) {
-    }
-    Result operator()() const { 
-        return ptr();
-    }
-};
-
-template <class Result>
-inline pointer_to_nullary_function<Result> ptr_fun(Result (*x)())
-{
-  return pointer_to_nullary_function<Result>(x);
-}
-
-/*********** compose_f_gx_t and compose_f_gx **********************/
-
-/* class for the compose_f_gx adapter
*/
-template <class OP1, class OP2>
-class compose_f_gx_t
- : public std::unary_function<typename OP2::argument_type,
-                              typename OP1::result_type>
-{
-  private:
-    OP1 op1;    // process: op1(op2(x))
-    OP2 op2;
-  public:
-    // constructor
-    compose_f_gx_t(const OP1& o1, const OP2& o2)
-     : op1(o1), op2(o2) {
-    }
-
-    // function call
-    typename OP1::result_type
-    operator()(const typename OP2::argument_type& x) const {
-        return op1(op2(x));
-    }
-};
-
-/* convenience functions for the compose_f_gx adapter
*/
-template <class OP1, class OP2>
-inline compose_f_gx_t<OP1,OP2>
-compose_f_gx (const OP1& o1, const OP2& o2) {
-    return compose_f_gx_t<OP1,OP2>(o1,o2);
-}
-
-/*********** compose_f_gx_hx_t and compose_f_gx_hx **********************/
-
-/* class for the compose_f_gx_hx adapter
*/
-template <class OP1, class OP2, class OP3>
-class compose_f_gx_hx_t
- : public std::unary_function<typename OP2::argument_type,
-                              typename OP1::result_type>
-{
-  private:
-    OP1 op1;    // process: op1(op2(x),op3(x))
-    OP2 op2;
-    OP3 op3;
-  public:
-    // constructor
-    compose_f_gx_hx_t (const OP1& o1, const OP2& o2, const OP3& o3)
-     : op1(o1), op2(o2), op3(o3) {
-    }
-
-    // function call
-    typename OP1::result_type
-    operator()(const typename OP2::argument_type& x) const {
-        return op1(op2(x),op3(x));
-    }
-};
-
-/* convenience functions for the compose_f_gx_hx adapter
*/
-template <class OP1, class OP2, class OP3>
-inline compose_f_gx_hx_t<OP1,OP2,OP3>
-compose_f_gx_hx (const OP1& o1, const OP2& o2, const OP3& o3) {
-    return compose_f_gx_hx_t<OP1,OP2,OP3>(o1,o2,o3);
-}
-
-/*********** compose_f_gxy_t and compose_f_gxy **********************/
-
-/* class for the compose_f_gxy adapter
*/
-template <class OP1, class OP2>
-class compose_f_gxy_t
- : public std::binary_function<typename OP2::first_argument_type,
-                               typename OP2::second_argument_type,
-                               typename OP1::result_type>
-{
-  private:
-    OP1 op1;    // process: op1(op2(x,y))
-    OP2 op2;
-  public:
-    // constructor
-    compose_f_gxy_t (const OP1& o1, const OP2& o2)
-     : op1(o1), op2(o2) {
-    }
-
-    // function call
-    typename OP1::result_type
-    operator()(const typename OP2::first_argument_type& x,
-               const typename OP2::second_argument_type& y) const {
-        return op1(op2(x,y));
-    }
-};
-
-/* convenience function for the compose_f_gxy adapter
*/
-template <class OP1, class OP2>
-inline compose_f_gxy_t<OP1,OP2>
-compose_f_gxy (const OP1& o1, const OP2& o2) {
-    return compose_f_gxy_t<OP1,OP2>(o1,o2);
-}
-
-/*********** compose_f_gx_hy_t and compose_f_gx_hy **********************/
-
-/* class for the compose_f_gx_hy adapter
*/
-template <class OP1, class OP2, class OP3>
-class compose_f_gx_hy_t
- : public std::binary_function<typename OP2::argument_type,
-                               typename OP3::argument_type,
-                               typename OP1::result_type>
-{
-  private:
-    OP1 op1;    // process: op1(op2(x),op3(y))
-    OP2 op2;
-    OP3 op3;
-  public:
-    // constructor
-    compose_f_gx_hy_t (const OP1& o1, const OP2& o2, const OP3& o3)
-     : op1(o1), op2(o2), op3(o3) {
-    }
-
-    // function call
-    typename OP1::result_type
-    operator()(const typename OP2::argument_type& x,
-               const typename OP3::argument_type& y) const {
-        return op1(op2(x),op3(y));
-    }
-};
-
-/* convenience function for the compose_f_gx_hy adapter
*/
-template <class OP1, class OP2, class OP3>
-inline compose_f_gx_hy_t<OP1,OP2,OP3>
-compose_f_gx_hy (const OP1& o1, const OP2& o2, const OP3& o3) {
-    return compose_f_gx_hy_t<OP1,OP2,OP3>(o1,o2,o3);
-}
-
-/*********** compose_f_g_t and compose_f_g **********************/
-
-/* class for the compose_f_g adapter
*/
-template <class OP1, class OP2>
-class compose_f_g_t
- : public boost::nullary_function<typename OP1::result_type>
-{
-  private:
-    OP1 op1;    // process: op1(op2())
-    OP2 op2;
-  public:
-    // constructor
-    compose_f_g_t(const OP1& o1, const OP2& o2)
-     : op1(o1), op2(o2) {
-    }
-
-    // function call
-    typename OP1::result_type
-    operator()() const {
-        return op1(op2());
-    }
-};
-
-/* convenience functions for the compose_f_g adapter
*/
-template <class OP1, class OP2>
-inline compose_f_g_t<OP1,OP2>
-compose_f_g (const OP1& o1, const OP2& o2) {
-    return compose_f_g_t<OP1,OP2>(o1,o2);
-}
-
-} /* namespace boost */
-
-#endif /*BOOST_COMPOSE_HPP*/
-
- - diff --git a/compose.html b/compose.html deleted file mode 100644 index 4b9f453..0000000 --- a/compose.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - DEPRECATED: Compose Function Object Adapters - - -  - - - - -
DEPRECATED: Compose - Function Object Adapters
- -

This library is deprecated in favor of the Bind or Lambda libraries, and will be removed in a future release of Boost. The C++ Standard Template Library STL as -part of the C++ Standard Library provides several function objects. Unfortunately, -it doesn't provide the ability to compose these function objects. For example, -it is not possible to combine the result of two unary operations to formulate -a criterion such as ``this and that''. But this would be -important for building software components out of other components, which -leads to the concept of functional composition. So, here are some adapters -that close this gap. -

In fact, these adapters provide to compose -function objects as follows: -
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FunctionalityBoost NameSGI STL's Name
f(g(value))compose_f_gxcompose1
f(g(value),h(value))compose_f_gx_hxcompose2
f(g(value1),h(value2))compose_f_gx_hy
f(g(value1,value2))compose_f_gxy
f(g())compose_f_g
- -

As you can see, two of these adapters are -part of the SGI STL already. -However, we changed the names according to -a consistent naming scheme for all adapters. -

In addition, this code also defines a type nullary_function - for function objects that have no argument (as supplement to unary_function - and binary_function) and overloads - ptr_fun for functions that take - no arguments. -

The code is provided "as is" without expressed - or implied warranty. -

compose.hpp: -

  • -as HTML file
  • - -
  • as plain file
    -
    - Example for using compose_f_gx
  • -
  • -as HTML file
  • - -
  • -as plain file
  • - -
    -Example for using compose_f_gx_hx -
  • -as HTML file
  • - -
  • -as plain file
  • - -
    Example for using -compose_f_gx_hy -
  • -as HTML file
  • - -
  • -as plain file
  • - -
    Example for using -compose_f_g -and ptr_fun for functions without arguments -
  • -as HTML file
  • - -
  • as plain file
    -
    -
    - To find more details about function objects in - general and about these compose functions, see
    -      The - C++ Standard Library - A Tutorial and Reference
    -      by Nicolai M. Josuttis -
    -      Addison Wesley Longman, - 1999
    -      ISBN 0-201-37926-0 -
    - and the SGI - STL documentation
  • - -

    Home -Page -
      - - - - \ No newline at end of file diff --git a/compose1.cpp b/compose1.cpp deleted file mode 100644 index 6ef61dc..0000000 --- a/compose1.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* The following code example is taken from the book - * "The C++ Standard Library - A Tutorial and Reference" - * by Nicolai M. Josuttis, Addison-Wesley, 1999 - * - * (C) Copyright Nicolai M. Josuttis 1999. - * 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 -#include -#include -#include -#include -#include "print.hpp" -#include - -using namespace std; -using namespace boost; - -int main() -{ - vector coll; - - // insert elements from 1 to 9 - for (int i=1; i<=9; ++i) { - coll.push_back(i); - } - PRINT_ELEMENTS(coll); - - // for each element add 10 and multiply by 5 - transform (coll.begin(),coll.end(), - ostream_iterator(cout," "), - compose_f_gx(bind2nd(multiplies(),5), - bind2nd(plus(),10))); - cout << endl; -} diff --git a/compose1.cpp.html b/compose1.cpp.html deleted file mode 100644 index 2bd86eb..0000000 --- a/compose1.cpp.html +++ /dev/null @@ -1,54 +0,0 @@ - - -compose1.cpp - - - -  - -
    - - compose1.cpp - -

    - - - The following code example is taken from the book
    - - The C++ Standard Library - A Tutorial and Reference
    - by Nicolai M. Josuttis, Addison-Wesley, 1999
    - - © Copyright Nicolai M. Josuttis 1999
    -
    - -

    -#include <iostream>
    -#include <vector>
    -#include <algorithm>
    -#include <functional>
    -#include <iterator>
    -#include "print.hpp"
    -#include "compose.hpp"
    -using namespace std;
    -using namespace boost;
    -
    -int main()
    -{
    -    vector<int> coll;
    -
    -    // insert elements from 1 to 9
    -    for (int i=1; i<=9; ++i) {
    -        coll.push_back(i);
    -    }
    -    PRINT_ELEMENTS(coll);
    -
    -    // for each element add 10 and multiply by 5
    -    transform (coll.begin(),coll.end(),
    -               ostream_iterator<int>(cout," "),
    -               compose_f_gx(bind2nd(multiplies<int>(),5),
    -                            bind2nd(plus<int>(),10)));
    -    cout << endl;
    -}
    -
    - - diff --git a/compose2.cpp b/compose2.cpp deleted file mode 100644 index 639f553..0000000 --- a/compose2.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* The following code example is taken from the book - * "The C++ Standard Library - A Tutorial and Reference" - * by Nicolai M. Josuttis, Addison-Wesley, 1999 - * - * (C) Copyright Nicolai M. Josuttis 1999. - * 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 -#include -#include -#include -#include "print.hpp" -#include -using namespace std; -using namespace boost; - -int main() -{ - vector coll; - - // insert elements from 1 to 9 - for (int i=1; i<=9; ++i) { - coll.push_back(i); - } - PRINT_ELEMENTS(coll); - - // remove all elements that are greater than four and less than seven - // - retain new end - vector::iterator pos; - pos = remove_if (coll.begin(),coll.end(), - compose_f_gx_hx(logical_and(), - bind2nd(greater(),4), - bind2nd(less(),7))); - - // remove ``removed'' elements in coll - coll.erase(pos,coll.end()); - - PRINT_ELEMENTS(coll); -} diff --git a/compose2.cpp.html b/compose2.cpp.html deleted file mode 100644 index 231da6b..0000000 --- a/compose2.cpp.html +++ /dev/null @@ -1,59 +0,0 @@ - - -compose2.cpp - - - -  - -
    - - compose2.cpp - -

    - - - The following code example is taken from the book
    - - The C++ Standard Library - A Tutorial and Reference
    - by Nicolai M. Josuttis, Addison-Wesley, 1999
    - - © Copyright Nicolai M. Josuttis 1999
    -
    - -

    -#include <iostream>
    -#include <vector>
    -#include <algorithm>
    -#include <functional>
    -#include "print.hpp"
    -#include "compose.hpp"
    -using namespace std;
    -using namespace boost;
    -
    -int main()
    -{
    -    vector<int> coll;
    -
    -    // insert elements from 1 to 9
    -    for (int i=1; i<=9; ++i) {
    -        coll.push_back(i);
    -    }
    -    PRINT_ELEMENTS(coll);
    -
    -    // remove all elements that are greater than four and less than seven
    -    // - retain new end
    -    vector<int>::iterator pos;
    -    pos = remove_if (coll.begin(),coll.end(),
    -                     compose_f_gx_hx(logical_and<bool>(),
    -                                     bind2nd(greater<int>(),4),
    -                                     bind2nd(less<int>(),7)));
    -
    -    // remove ``removed'' elements in coll
    -    coll.erase(pos,coll.end());
    -
    -    PRINT_ELEMENTS(coll);
    -}
    -
    - - diff --git a/compose3.cpp b/compose3.cpp deleted file mode 100644 index a694b04..0000000 --- a/compose3.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* The following code example is taken from the book - * "The C++ Standard Library - A Tutorial and Reference" - * by Nicolai M. Josuttis, Addison-Wesley, 1999 - * - * (C) Copyright Nicolai M. Josuttis 1999. - * 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 -#include -#include -#include -#include -#include -using namespace std; -using namespace boost; - -int main() -{ - string s("Internationalization"); - string sub("Nation"); - - // search substring case insensitive - string::iterator pos; - pos = search (s.begin(),s.end(), // string to search in - sub.begin(),sub.end(), // substring to search - compose_f_gx_hy(equal_to(), // compar. criterion - ptr_fun(::toupper), - ptr_fun(::toupper))); - - if (pos != s.end()) { - cout << "\"" << sub << "\" is part of \"" << s << "\"" - << endl; - } -} diff --git a/compose3.cpp.html b/compose3.cpp.html deleted file mode 100644 index e46f28e..0000000 --- a/compose3.cpp.html +++ /dev/null @@ -1,54 +0,0 @@ - - -compose3.cpp - - - -  - -
    - - compose3.cpp - -

    - - - The following code example is taken from the book
    - - The C++ Standard Library - A Tutorial and Reference
    - by Nicolai M. Josuttis, Addison-Wesley, 1999
    - - © Copyright Nicolai M. Josuttis 1999
    -
    - -

    -#include <iostream>
    -#include <algorithm>
    -#include <functional>
    -#include <string>
    -#include <cctype>
    -#include "compose.hpp"
    -using namespace std;
    -using namespace boost;
    -
    -int main()
    -{
    -    string s("Internationalization");
    -    string sub("Nation");
    -
    -    // search substring case insensitive
    -    string::iterator pos;
    -    pos = search (s.begin(),s.end(),           // string to search in
    -                  sub.begin(),sub.end(),       // substring to search
    -                  compose_f_gx_hy(equal_to<int>(), // compar. criterion
    -                                  ptr_fun(::toupper),
    -                                  ptr_fun(::toupper)));
    -
    -    if (pos != s.end()) {
    -        cout << "\"" << sub << "\" is part of \"" << s << "\""
    -             << endl;
    -    }
    -}
    -
    - - diff --git a/compose4.cpp b/compose4.cpp deleted file mode 100644 index 8c35dce..0000000 --- a/compose4.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* The following code example is taken from the book - * "The C++ Standard Library - A Tutorial and Reference" - * by Nicolai M. Josuttis, Addison-Wesley, 1999 - * - * (C) Copyright Nicolai M. Josuttis 1999. - * 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 -#include -#include -#include -#include "print.hpp" -#include -using namespace std; -using namespace boost; - - -int main() -{ - list coll; - - // insert five random numbers - generate_n (back_inserter(coll), // beginning of destination range - 5, // count - rand); // new value generator - PRINT_ELEMENTS(coll); - - // overwrite with five new random numbers - // in the range between 0 (including) and 10 (excluding) - generate (coll.begin(), coll.end(), // destination range - compose_f_g(bind2nd(modulus(),10), - ptr_fun(rand))); - PRINT_ELEMENTS(coll); -} diff --git a/compose4.cpp.html b/compose4.cpp.html deleted file mode 100644 index 75a93eb..0000000 --- a/compose4.cpp.html +++ /dev/null @@ -1,54 +0,0 @@ - - -compose4.cpp - - - -  - -
    - - compose4.cpp - -

    - - - The following code example is taken from the book
    - - The C++ Standard Library - A Tutorial and Reference
    - by Nicolai M. Josuttis, Addison-Wesley, 1999
    - - © Copyright Nicolai M. Josuttis 1999
    -
    - -

    -#include <list>
    -#include <algorithm>
    -#include <functional>
    -#include <cstdlib>
    -#include "print.hpp"
    -#include "compose.hpp"
    -using namespace std;
    -using namespace boost;
    -
    -
    -int main()
    -{
    -    list<int> coll;
    -
    -    // insert five random numbers
    -    generate_n (back_inserter(coll),      // beginning of destination range
    -                5,                        // count
    -                rand);                    // new value generator
    -    PRINT_ELEMENTS(coll);
    -
    -    // overwrite with five new random numbers
    -    // in the range between 0 (including) and 10 (excluding)
    -    generate (coll.begin(), coll.end(),   // destination range
    -              compose_f_g(bind2nd(modulus<int>(),10),
    -                          ptr_fun(rand)));
    -    PRINT_ELEMENTS(coll);
    -}
    -
    - - diff --git a/include/boost/compose.hpp b/include/boost/compose.hpp deleted file mode 100644 index f102f99..0000000 --- a/include/boost/compose.hpp +++ /dev/null @@ -1,233 +0,0 @@ -/* supplementing compose function objects - * Fri Jul 16 21:01:58 MEST 1999 - */ -/* The following code example is taken from the book - * "The C++ Standard Library - A Tutorial and Reference" - * by Nicolai M. Josuttis, Addison-Wesley, 1999 - * - * (C) Copyright Nicolai M. Josuttis 1999. - * 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. - */ - -// See http://www.boost.org/libs/compose for Documentation. - -#ifndef BOOST_DEPRECATED -# error Boost.Compose has been deprecated in favor of Boost.Bind or Boost.Lambda, and will be removed in a future release. You may define the macro BOOST_DEPRECATED to suppress this warning. -#endif - -#ifndef BOOST_COMPOSE_HPP -#define BOOST_COMPOSE_HPP - -#include - -namespace boost { - -/********************************************************** - * type nullary_function - * - as supplement to unary_function and binary_function - **********************************************************/ -template -struct nullary_function { - typedef Result result_type; -}; - -/********************************************************** - * ptr_fun for functions with no argument - **********************************************************/ -template -class pointer_to_nullary_function : public nullary_function -{ - protected: - Result (*ptr)(); - public: - pointer_to_nullary_function() { - } - explicit pointer_to_nullary_function(Result (*x)()) : ptr(x) { - } - Result operator()() const { - return ptr(); - } -}; - -template -inline pointer_to_nullary_function ptr_fun(Result (*x)()) -{ - return pointer_to_nullary_function(x); -} - -/*********** compose_f_gx_t and compose_f_gx **********************/ - -/* class for the compose_f_gx adapter - */ -template -class compose_f_gx_t - : public std::unary_function -{ - private: - OP1 op1; // process: op1(op2(x)) - OP2 op2; - public: - // constructor - compose_f_gx_t(const OP1& o1, const OP2& o2) - : op1(o1), op2(o2) { - } - - // function call - typename OP1::result_type - operator()(const typename OP2::argument_type& x) const { - return op1(op2(x)); - } -}; - -/* convenience functions for the compose_f_gx adapter - */ -template -inline compose_f_gx_t -compose_f_gx (const OP1& o1, const OP2& o2) { - return compose_f_gx_t(o1,o2); -} - -/*********** compose_f_gx_hx_t and compose_f_gx_hx **********************/ - -/* class for the compose_f_gx_hx adapter - */ -template -class compose_f_gx_hx_t - : public std::unary_function -{ - private: - OP1 op1; // process: op1(op2(x),op3(x)) - OP2 op2; - OP3 op3; - public: - // constructor - compose_f_gx_hx_t (const OP1& o1, const OP2& o2, const OP3& o3) - : op1(o1), op2(o2), op3(o3) { - } - - // function call - typename OP1::result_type - operator()(const typename OP2::argument_type& x) const { - return op1(op2(x),op3(x)); - } -}; - -/* convenience functions for the compose_f_gx_hx adapter - */ -template -inline compose_f_gx_hx_t -compose_f_gx_hx (const OP1& o1, const OP2& o2, const OP3& o3) { - return compose_f_gx_hx_t(o1,o2,o3); -} - -/*********** compose_f_gxy_t and compose_f_gxy **********************/ - -/* class for the compose_f_gxy adapter - */ -template -class compose_f_gxy_t - : public std::binary_function -{ - private: - OP1 op1; // process: op1(op2(x,y)) - OP2 op2; - public: - // constructor - compose_f_gxy_t (const OP1& o1, const OP2& o2) - : op1(o1), op2(o2) { - } - - // function call - typename OP1::result_type - operator()(const typename OP2::first_argument_type& x, - const typename OP2::second_argument_type& y) const { - return op1(op2(x,y)); - } -}; - -/* convenience function for the compose_f_gxy adapter - */ -template -inline compose_f_gxy_t -compose_f_gxy (const OP1& o1, const OP2& o2) { - return compose_f_gxy_t(o1,o2); -} - -/*********** compose_f_gx_hy_t and compose_f_gx_hy **********************/ - -/* class for the compose_f_gx_hy adapter - */ -template -class compose_f_gx_hy_t - : public std::binary_function -{ - private: - OP1 op1; // process: op1(op2(x),op3(y)) - OP2 op2; - OP3 op3; - public: - // constructor - compose_f_gx_hy_t (const OP1& o1, const OP2& o2, const OP3& o3) - : op1(o1), op2(o2), op3(o3) { - } - - // function call - typename OP1::result_type - operator()(const typename OP2::argument_type& x, - const typename OP3::argument_type& y) const { - return op1(op2(x),op3(y)); - } -}; - -/* convenience function for the compose_f_gx_hy adapter - */ -template -inline compose_f_gx_hy_t -compose_f_gx_hy (const OP1& o1, const OP2& o2, const OP3& o3) { - return compose_f_gx_hy_t(o1,o2,o3); -} - -/*********** compose_f_g_t and compose_f_g **********************/ - -/* class for the compose_f_g adapter - */ -template -class compose_f_g_t - : public boost::nullary_function -{ - private: - OP1 op1; // process: op1(op2()) - OP2 op2; - public: - // constructor - compose_f_g_t(const OP1& o1, const OP2& o2) - : op1(o1), op2(o2) { - } - - // function call - typename OP1::result_type - operator()() const { - return op1(op2()); - } -}; - -/* convenience functions for the compose_f_g adapter - */ -template -inline compose_f_g_t -compose_f_g (const OP1& o1, const OP2& o2) { - return compose_f_g_t(o1,o2); -} - -} /* namespace boost */ - -#endif /*BOOST_COMPOSE_HPP*/ diff --git a/index.html b/index.html deleted file mode 100644 index 38acb69..0000000 --- a/index.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - - -Automatic redirection failed, please go to -index.htm - - diff --git a/print.hpp b/print.hpp deleted file mode 100644 index 4325f47..0000000 --- a/print.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/* The following code example is taken from the book - * "The C++ Standard Library - A Tutorial and Reference" - * by Nicolai M. Josuttis, Addison-Wesley, 1999 - * - * (C) Copyright Nicolai M. Josuttis 1999. - * 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 - -/* PRINT_ELEMENTS() - * - prints optional C-string optcstr followed by - * - all elements of the collection coll - * - separated by spaces - */ -template -inline void PRINT_ELEMENTS (const T& coll, const char* optcstr="") -{ - typename T::const_iterator pos; - - std::cout << optcstr; - for (pos=coll.begin(); pos!=coll.end(); ++pos) { - std::cout << *pos << ' '; - } - std::cout << std::endl; -} diff --git a/print.hpp.html b/print.hpp.html deleted file mode 100644 index 2bc6190..0000000 --- a/print.hpp.html +++ /dev/null @@ -1,45 +0,0 @@ - - -PRINT_ELEMENTS() - - - -  - -
    - - PRINT_ELEMENTS() - -

    - - - The following code example is taken from the book
    - - The C++ Standard Library - A Tutorial and Reference
    - by Nicolai M. Josuttis, Addison-Wesley, 1999
    - - © Copyright Nicolai M. Josuttis 1999
    -
    - -

    -#include <iostream>
    -
    -/* PRINT_ELEMENTS()
    * - prints optional C-string optcstr followed by
    * - all elements of the collection coll
    * - separated by spaces
    */
    -template <class T>
    -inline void PRINT_ELEMENTS (const T& coll, const char* optcstr="")
    -{
    -    typename T::const_iterator pos;
    -
    -    std::cout << optcstr;
    -    for (pos=coll.begin(); pos!=coll.end(); ++pos) {
    -        std::cout << *pos << ' ';
    -    }
    -    std::cout << std::endl;
    -}
    -
    - -