|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r78829 - trunk/libs/math/doc/sf_and_dist
From: pbristow_at_[hidden]
Date: 2012-06-06 07:30:24
Author: pbristow
Date: 2012-06-06 07:30:24 EDT (Wed, 06 Jun 2012)
New Revision: 78829
URL: http://svn.boost.org/trac/boost/changeset/78829
Log:
Corrected #include filenames etc.
Text files modified:
trunk/libs/math/doc/sf_and_dist/constants.qbk | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
Modified: trunk/libs/math/doc/sf_and_dist/constants.qbk
==============================================================================
--- trunk/libs/math/doc/sf_and_dist/constants.qbk (original)
+++ trunk/libs/math/doc/sf_and_dist/constants.qbk 2012-06-06 07:30:24 EDT (Wed, 06 Jun 2012)
@@ -34,26 +34,27 @@
[section:non_templ Use in non-template code]
When using the math constants at your chosen fixed precision in non-template code,
-you can simply add a `using` declaration, for example, `using boost::math::double_constants`,
+you can simply add a `using namespace` declaration, for example,
+`using namespace boost::math::double_constants`,
to make the constants of the correct precision for your code
-visible in the current scope, and then use each constant ['as a simple variable]:
+visible in the current scope, and then use each constant ['as a simple variable - sans brackets]:
- #include <boost/math/constants.hpp>
+ #include <boost/math/constants/constants.hpp>
double area(double r)
{
- using boost::math::double_constants;
+ using namespace boost::math::double_constants;
return pi * r * r;
}
Had our function been written as taking a `float` rather than a `double`,
we could have written instead:
- #include <boost/math/constants.hpp>
+ #include <boost/math/constants/constants.hpp>
float area(float r)
{
- using boost::math::float_constants;
+ using namespace boost::math::float_constants;
return pi * r * r;
}
@@ -62,6 +63,8 @@
You can see the full list of available constants at [link math_toolkit.constants.constants].
+Some examples of using constants are at [@../../../example/constants_eg1.cpp constants_eg1].
+
[endsect]
[section:templ Use in template code]
@@ -71,7 +74,7 @@
We can do this by calling the function-template versions, `pi<FPType>()`, of the constants
like this:
- #include <boost/math/constants.hpp>
+ #include <boost/math/constants/constants.hpp>
template <class Real>
Real area(Real r)
@@ -139,7 +142,7 @@
The syntax for using the function-call constants with user-defined types is the same
as it is in the template class, which is to say we use:
- #include <boost/math/constants.hpp>
+ #include <boost/math/constants/constants.hpp>
boost::math::constants::pi<UserDefinedType>();
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk