Files
boost_function/example/int_div.cpp
Douglas Gregor d37903b2e7 index.html:
- Removed reference and tutorial: now just link to them

faq.html:
	- Moved to doc/faq.html

doc/faq.html:
	- Relative directory fixups

doc/reference.html:
	- Reference manual for Boost.Function

doc/tutorial.html:
	- Tutorial for Boost.Function (the old "Usage" sections)
	- Additional example showing the use of references and arrays

example/bind1st.cpp:
example/int_div.cpp:
example/sum_avg.cpp:
	- Examples from tutorial


[SVN r10620]
2001-07-14 19:57:09 +00:00

33 lines
898 B
C++

// Boost.Function library examples
// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
//
// Permission to copy, use, sell and distribute this software is granted
// provided this copyright notice appears in all copies.
// Permission to modify the code and to distribute modified code is granted
// provided this copyright notice appears in all copies, and a notice
// that the code was modified is included with the copyright notice.
//
// This software is provided "as is" without express or implied warranty,
// and with no claim as to its suitability for any purpose.
// For more information, see http://www.boost.org
#include <iostream>
#include <boost/function.hpp>
struct int_div {
float operator()(int x, int y) const { return ((float)x)/y; };
};
int
main()
{
boost::function<float, int, int> f;
f = int_div();
std::cout << f(5, 3) << std::endl; // 1.66667
return 0;
}