Update of /cvsroot/boost/boost/libs/numeric/conversion/doc
In directory 
sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16836/libs/numeric/conversion/doc

Modified Files:
      Tag: RC_1_34_0
        conversion_traits.html converter.html numeric_cast.html 
Log Message:
none_t/none reimplemented to avoid precompiled header issues (thanks to Joe 
Gottam)
optional<T> now has direct relational operator
optional<T>::operator-> fixed for reference types

Index: conversion_traits.html
===================================================================
RCS file: 
/cvsroot/boost/boost/libs/numeric/conversion/doc/conversion_traits.html,v
retrieving revision 1.6
retrieving revision 1.6.4.1
diff -u -d -r1.6 -r1.6.4.1
--- conversion_traits.html      4 Jun 2005 06:01:14 -0000       1.6
+++ conversion_traits.html      1 Mar 2007 23:08:33 -0000       1.6.4.1
@@ -297,9 +297,12 @@
 
 <H2><A NAME="examples">Examples</A></H2>
 <BLOCKQUOTE>
-  <PRE>#include &lt;boost/numeric/conversion_traits.hpp&gt;
+  <PRE>#include &lt;cassert&gt;
+#include &lt;typeinfo&gt;
+#include &lt;boost/numeric/conversion/conversion_traits.hpp&gt;
 
-int main() {
+int main()
+{
 
   // A trivial conversion.
   typedef boost::numeric::conversion_traits&lt;short,short&gt; 
Short2Short_Traits ;
@@ -307,24 +310,24 @@
 
   // A subranged conversion.
   typedef boost::numeric::conversion_traits&lt;double,unsigned int&gt; 
UInt2Double_Traits ;
-  assert (  UInt2Double_Traits::mixture::value == 
boost::numeric::integral_to_float ) ;
+  assert (  UInt2Double_Traits::int_float_mixture::value == 
boost::numeric::integral_to_float ) ;
   assert (  UInt2Double_Traits::sign_mixture::value == 
boost::numeric::unsigned_to_signed ) ;
   assert ( !UInt2Double_Traits::subranged::value ) ;
   assert ( typeid(UInt2Double_Traits::supertype) == typeid(double) ) ;
   assert ( typeid(UInt2Double_Traits::subtype) == typeid(unsigned int) ) ;
 
   // A doubly subranged conversion.
-  assert (    boost::numeric::conversion_traits&lt;short, unsigned 
short&gt;::subranged::value
-           &amp;&amp; boost::numeric::conversion_traits&lt;unsigned short, 
short&gt;::subranged::value
-         )
+  assert ( (boost::numeric::conversion_traits&lt;short, unsigned 
short&gt;::subranged::value) );
+  assert ( (boost::numeric::conversion_traits&lt;unsigned short, 
short&gt;::subranged::value) );
 
   return 0;
-}</PRE>
+}
+</PRE>
    </BLOCKQUOTE>
 <HR>
 <P>Back to <A HREF="index.html">Numeric Conversion library index</A></P>
 <HR>
-<P>Revised 16 May 2005</P>
+<P>Revised 23 November 2006</P>
 <p>© Copyright Fernando Luis Cacciola Carballal, 2004</p>
 <p> Use, modification, and distribution are subject to the Boost Software
 License, Version 1.0. (See accompanying file <a 
href="../../../../LICENSE_1_0.txt">

Index: converter.html
===================================================================
RCS file: /cvsroot/boost/boost/libs/numeric/conversion/doc/converter.html,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -d -r1.7 -r1.7.2.1
--- converter.html      12 Aug 2005 13:02:35 -0000      1.7
+++ converter.html      1 Mar 2007 23:08:33 -0000       1.7.2.1
@@ -241,11 +241,12 @@
 <HR>
 <H2><A NAME="examples">Examples</A></H2>
 <BLOCKQUOTE>
-  <PRE>#include &lt;boost/numeric/conversion/converter.hpp&gt;
+  <PRE>  #include &lt;cassert&gt;
+  #include &lt;boost/numeric/conversion/converter.hpp&gt;
 
-int main() {
+  int main() {
 
-  typedef boost::numeric::converter&lt;int,doublegt; Double2Int ;
+  typedef boost::numeric::converter&lt;int,double&gt; Double2Int ;
 
   int x = Double2Int::convert(2.0);
   assert ( x == 2 );

Index: numeric_cast.html
===================================================================
RCS file: /cvsroot/boost/boost/libs/numeric/conversion/doc/numeric_cast.html,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -d -r1.4 -r1.4.2.1
--- numeric_cast.html   12 Aug 2005 13:02:35 -0000      1.4
+++ numeric_cast.html   1 Mar 2007 23:08:33 -0000       1.4.2.1
@@ -52,10 +52,10 @@
         <H2><A NAME="numeric_cast"><CODE>numeric_cast</CODE></A></H2>
         <BLOCKQUOTE>
                <PRE>template&lt;typename Target, typename Source&gt; inline
-typename boost::numeric::converter&lt;Traget,Source&gt;::result_type
+typename boost::numeric::converter&lt;Target,Source&gt;::result_type
 numeric_cast ( Source arg )
 {
-   return boost::numeric::converter&lt;Traget,Source&gt;::convert(arg);
+   return boost::numeric::converter&lt;Target,Source&gt;::convert(arg);
 }
 </PRE> </BLOCKQUOTE>
         <P>numeric_cast returns the result of converting a value of type 
Source to a value of type
@@ -67,18 +67,21 @@
         <P>The following example performs some typical conversions between 
numeric
                types: </P>
         <BLOCKQUOTE>
-               <PRE>#include &lt;boost/numeric_cast.hpp&gt;
+               <PRE>#include &lt;boost/numeric/conversion/cast.hpp&gt;
 #include &lt;iostream&gt;
 
 int main()
 {
    using boost::numeric_cast;
-   using boost::bad_numeric_cast;
-   using boost::positive_overflow;
-   using boost::negative_overflow;
-      try {
+   
+   using boost::numeric::bad_numeric_cast;
+   using boost::numeric::positive_overflow;
+   using boost::numeric::negative_overflow;
+   
+   try 
+   {
       int i=42;
-      short s=numeric_cast&lt;short&gt;(i);
+      short s=numeric_cast&lt;short&gt;(i); // This conversion succeeds (is in 
range)
    }
    catch(negative_overflow&amp; e) {
       std::cout &lt;&lt; e.what();
@@ -87,32 +90,40 @@
       std::cout &lt;&lt; e.what();
    }
 
-   try {
+   try 
+   {
       float f=-42.1234;
-      // This will cause a boost::negative_underflow exception to be thrown
+      
+      // This will cause a boost::numeric::negative_overflow exception to be 
thrown
       unsigned int i=numeric_cast&lt;unsigned int&gt;(f);
+   }
+   catch(bad_numeric_cast&amp; e) {
+      std::cout &lt;&lt; e.what();
+   }
 
-      double d=f+numeric_cast&lt;double&gt;(i);
-
-      unsigned long l=std::numeric_limits&lt;unsigned long&gt;::max();
-      // This works, because unsigned integral types cannot cause overflow.
-      unsigned char c=numeric_cast&lt;unsigned char&gt;(l);
-
-      unsigned short us=std::numeric_limits&lt;unsigned short&gt;::max();
-      // This will cause an positive_overflow exception to be thrown
-      short s=numeric_cast&lt;short&gt;(us);
+   double d= f + numeric_cast&lt;double&gt;(123); // int -> double
 
+   unsigned long l=std::numeric_limits&lt;unsigned long&gt;::max();
+      
+   try 
+   {
+     // This will cause a boost::numeric::positive_overflow exception to be 
thrown
+     // NOTE: *operations* on unsigned integral types cannot cause overflow
+     // but *conversions* to a signed type ARE range checked by numeric_cast.
+     
+     unsigned char c=numeric_cast&lt;unsigned char&gt;(l);
    }
-   catch(bad_numeric_cast&amp; e) {
+   catch(positive_overflow&amp; e) {
       std::cout &lt;&lt; e.what();
    }
 
+
    return 0;
 }</PRE> </BLOCKQUOTE> <BR> <BR> <HR>
 <HR>
 <P>Back to <A HREF="index.html">Numeric Conversion library index</A></P>
 <HR>
-<P>Revised 23 June 2004</P>
+<P>Revised 20 May 2006</P>
 <p>© Copyright Boost 1999</p>
 <p>© Copyright Fernando Luis Cacciola Carballal, 1999,2004</p>
 <p> Use, modification, and distribution are subject to the Boost Software


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to