Boost logo

Boost-Commit :

From: john_at_[hidden]
Date: 2007-08-04 05:03:49


Author: johnmaddock
Date: 2007-08-04 05:03:48 EDT (Sat, 04 Aug 2007)
New Revision: 38438
URL: http://svn.boost.org/trac/boost/changeset/38438

Log:
Added a bit more of the tutorial
Text files modified:
   sandbox/math_toolkit/libs/math/doc/policy.qbk | 29 ++++++++++++++++++++++++++++-
   sandbox/math_toolkit/libs/math/example/policy_eg_7.cpp | 20 +-------------------
   2 files changed, 29 insertions(+), 20 deletions(-)

Modified: sandbox/math_toolkit/libs/math/doc/policy.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/policy.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/policy.qbk 2007-08-04 05:03:48 EDT (Sat, 04 Aug 2007)
@@ -255,12 +255,39 @@
 
 [policy_eg_4]
 
-The same mechanism works well at file scope as well:
+The same mechanism works well at file scope as well, by using an unnamed
+namespace, we can ensure that these declarations don't conflict with any
+alternate policies present in other translation units:
 
 [import ../example/policy_eg_5.cpp]
 
 [policy_eg_5]
 
+Handling the statistical distributions is very similar except that now
+the macro BOOST_MATH_DECLARE_DISTRIBUTIONS accepts two parameters: the
+floating point type to use, and the policy type to apply. For example:
+
+ BOOST_MATH_DECLARE_DISTRIBUTIONS(double, mypolicy)
+
+Results a set of typedefs being defined like this:
+
+ typedef boost::math::normal_distribution<double, mypolicy> normal;
+
+The name of each typedef is the same as the name of the distribution
+class template, but without the "_distribution" suffix.
+
+[import ../example/policy_eg_6.cpp]
+
+[policy_eg_6]
+
+As before the same mechanism works well at file scope as well, by using an unnamed
+namespace, we can ensure that these declarations don't conflict with any
+alternate policies present in other translation units:
+
+[import ../example/policy_eg_7.cpp]
+
+[policy_eg_7]
+
 [endsect][/section:pol_Tutorial Policy Tutorial]
 
 [section:pol_ref Policy Reference]

Modified: sandbox/math_toolkit/libs/math/example/policy_eg_7.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/example/policy_eg_7.cpp (original)
+++ sandbox/math_toolkit/libs/math/example/policy_eg_7.cpp 2007-08-04 05:03:48 EDT (Sat, 04 Aug 2007)
@@ -53,23 +53,5 @@
       << quantile(complement(binom, 0.05)) << std::endl;
 }
 
-/*`
-
-Which outputs:
-
-[pre
-Result of quantile(norm, 0) is: -1.#INF
-errno = 34
-Result of quantile(norm, 1) is: 1.#INF
-errno = 34
-Result of quantile(binom, 0.05) is: 1
-Result of quantile(complement(binom, 0.05)) is: 8
-]
-
-This mechanism is particularly useful when we want to define a
-project-wide policy, and don't want to modify the Boost source
-or set - possibly fragile and easy to forget - project wide
-build macros.
-
-*/ //] ends quickbook imported section
+//] ends quickbook imported section
 


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