mirror of
				https://github.com/boostorg/utility.git
				synced 2025-10-31 08:21:45 +01:00 
			
		
		
		
	Compare commits
	
		
			99 Commits
		
	
	
		
			svn-branch
			...
			boost-1.34
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 18ee1dac7d | ||
|  | d5ea07c737 | ||
|  | aa0096bf42 | ||
|  | 005c2f3cc8 | ||
|  | 09f7aab52d | ||
|  | 30a40f9f76 | ||
|  | d9f8bae673 | ||
|  | 3c7b409460 | ||
|  | ee3551e8dc | ||
|  | 95da2e90de | ||
|  | 6dd93ab916 | ||
|  | 505d419a1b | ||
|  | d968b5f5b9 | ||
|  | d809d4e832 | ||
|  | 271ea9e901 | ||
|  | 7cd572a326 | ||
|  | 90c56ba2ce | ||
|  | a5439500f5 | ||
|  | c0f0a4f51d | ||
|  | 7594e00460 | ||
|  | f66e844ff1 | ||
|  | 62e8cc2b36 | ||
|  | 30236f8915 | ||
|  | 155e787ea3 | ||
|  | 1d60d49136 | ||
|  | 2dffdac9fe | ||
|  | ddf00eb29d | ||
|  | 0a6acd8ce8 | ||
|  | 745322e797 | ||
|  | 9f10fc03ce | ||
|  | 84fbb3c896 | ||
|  | 865c707756 | ||
|  | 871f3a6779 | ||
|  | aaca5ca871 | ||
|  | 5a4e19989f | ||
|  | 6ea398c446 | ||
|  | 1bd83d43e8 | ||
|  | 5ca5b4102b | ||
|  | aca7699046 | ||
|  | e702a944ca | ||
|  | a157c345ee | ||
|  | dcb2dd4736 | ||
|  | ae19cd6236 | ||
|  | 3ab4d38931 | ||
|  | 18c7fb72b5 | ||
|  | 6bb092a9b1 | ||
|  | f721b8b28c | ||
|  | e5ba34472d | ||
|  | 082ae17eaf | ||
|  | dd86e09ab4 | ||
|  | baff23116e | ||
|  | e549baf93a | ||
|  | 30d46adcb7 | ||
|  | e854726be0 | ||
|  | d198bd9d96 | ||
|  | 5eb23cecd0 | ||
|  | eff2c75bba | ||
|  | 325bd73df7 | ||
|  | 0fcc554abd | ||
|  | b685784155 | ||
|  | ac90fdc611 | ||
|  | 51077e49f5 | ||
|  | 0c3199f72d | ||
|  | 62675a3bcd | ||
|  | c26dbaa620 | ||
|  | 8201624959 | ||
|  | f2116413d6 | ||
|  | b0baebeb0a | ||
|  | fb943b77d5 | ||
|  | b4b39510fc | ||
|  | 6f0f05ba12 | ||
|  | f0b64b6229 | ||
|  | 4229488989 | ||
|  | acd2e6ef2b | ||
|  | c26aaed71f | ||
|  | 326d7ad4d7 | ||
|  | c76a2f4aab | ||
|  | d8b0ff2d7e | ||
|  | 996ce2d307 | ||
|  | 167fa4154f | ||
|  | 0c7e7c3c39 | ||
|  | 9d8f8f41dc | ||
|  | 39c4445b39 | ||
|  | 7819b022ad | ||
|  | 65d27e7f86 | ||
|  | 212a70bf77 | ||
|  | 6b5dc18a46 | ||
|  | 0917f83b9c | ||
|  | 7322bd3903 | ||
|  | e998010184 | ||
|  | 918a1c93e4 | ||
|  | 14c87853c2 | ||
|  | d5a5b84a40 | ||
|  | 35d3c03d19 | ||
|  | 8933fbb254 | ||
|  | c320330cd5 | ||
|  | 822b46a3df | ||
|  | a821ef6e2c | ||
|  | 491db15997 | 
							
								
								
									
										199
									
								
								Assignable.html
									
									
									
									
									
								
							
							
						
						
									
										199
									
								
								Assignable.html
									
									
									
									
									
								
							| @@ -1,116 +1,109 @@ | ||||
| <HTML> | ||||
| <!-- | ||||
|   -- Copyright (c) Jeremy Siek 2000 | ||||
|   -- | ||||
|   -- Permission to use, copy, modify, distribute and sell this software | ||||
|   -- and its documentation for any purpose is hereby granted without fee, | ||||
|   -- provided that the above copyright notice appears in all copies and | ||||
|   -- that both that copyright notice and this permission notice appear | ||||
|   -- in supporting documentation.  Silicon Graphics makes no | ||||
|   -- representations about the suitability of this software for any | ||||
|   -- purpose.  It is provided "as is" without express or implied warranty. | ||||
|   --> | ||||
| <Head> | ||||
| <Title>Assignable</Title> | ||||
| </HEAD> | ||||
| <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"  | ||||
|         ALINK="#ff0000">  | ||||
| <IMG SRC="../../c++boost.gif"  | ||||
|      ALT="C++ Boost" width="277" height="86">  | ||||
| <!--end header--> | ||||
| <BR Clear> | ||||
| <H1>Assignable</H1> | ||||
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | ||||
|  | ||||
| <h3>Description</h3> | ||||
| A type is Assignable if it is possible to assign one object of the type | ||||
| to another object of that type. | ||||
| <html> | ||||
| <head> | ||||
|   <meta http-equiv="Content-Language" content="en-us"> | ||||
|   <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> | ||||
|  | ||||
|   <title>Assignable</title> | ||||
| </head> | ||||
|  | ||||
| <h3>Notation</h3> | ||||
| <Table> | ||||
| <TR> | ||||
| <TD VAlign=top> | ||||
| <tt>T</tt> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| is type that is a model of Assignable | ||||
| </TD> | ||||
| </TR> | ||||
| <body bgcolor="#FFFFFF" link="#0000EE" text="#000000" vlink="#551A8B" alink= | ||||
| "#FF0000"> | ||||
|   <img src="../../boost.png" alt="C++ Boost" width="277" height= | ||||
|   "86"><br clear="none"> | ||||
|  | ||||
| <TR> | ||||
| <TD VAlign=top> | ||||
| <tt>t</tt> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| is an object of type <tt>T</tt> | ||||
| </TD> | ||||
| </tr> | ||||
|   <h1>Assignable</h1> | ||||
|  | ||||
| <TR> | ||||
| <TD VAlign=top> | ||||
| <tt>u</tt> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| is an object of type <tt>T</tt> or possibly <tt>const T</tt> | ||||
| </TD> | ||||
| </tr> | ||||
|   <h3>Description</h3> | ||||
|  | ||||
| </table> | ||||
| <h3>Definitions</h3> | ||||
| <h3>Valid expressions</h3> | ||||
| <Table border> | ||||
| <TR> | ||||
| <TH> | ||||
| Name | ||||
| </TH> | ||||
| <TH> | ||||
| Expression | ||||
| </TH> | ||||
| <TH> | ||||
| Return type | ||||
| </TH> | ||||
| <TH> | ||||
| Semantics | ||||
| </TH> | ||||
| </TR> | ||||
| <TR> | ||||
| <TD VAlign=top> | ||||
| Assignment | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <tt>t = u</tt> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <tt>T&</tt> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <tt>t</tt> is equivalent to <tt>u</tt> | ||||
| </TD> | ||||
| </TR> | ||||
|   <p>A type is Assignable if it is possible to assign one object of the type | ||||
|   to another object of that type.</p> | ||||
|  | ||||
| </table> | ||||
|   <h3>Notation</h3> | ||||
|  | ||||
|   <table summary=""> | ||||
|     <tr> | ||||
|       <td valign="top"><tt>T</tt></td> | ||||
|  | ||||
| </table> | ||||
| <h3>Models</h3> | ||||
|       <td valign="top">is type that is a model of Assignable</td> | ||||
|     </tr> | ||||
|  | ||||
| <UL> | ||||
| <LI><tt>int</tt> | ||||
| <LI><tt>std::pair</tt> | ||||
| </UL> | ||||
|     <tr> | ||||
|       <td valign="top"><tt>t</tt></td> | ||||
|  | ||||
| <h3>See also</h3> | ||||
| <a href="http://www.sgi.com/tech/stl/DefaultConstructible.html">DefaultConstructible</A> | ||||
| and  | ||||
| <A href="./CopyConstructible.html">CopyConstructible</A> | ||||
|       <td valign="top">is an object of type <tt>T</tt></td> | ||||
|     </tr> | ||||
|  | ||||
| <br> | ||||
| <HR> | ||||
| <TABLE> | ||||
| <TR valign=top> | ||||
| <TD nowrap>Copyright © 2000</TD><TD> | ||||
| <A HREF=http://www.lsc.nd.edu/~jsiek>Jeremy Siek</A>, Univ.of Notre Dame (<A HREF="mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</A>) | ||||
| </TD></TR></TABLE> | ||||
|     <tr> | ||||
|       <td valign="top"><tt>u</tt></td> | ||||
|  | ||||
| </BODY> | ||||
| </HTML>  | ||||
|       <td valign="top">is an object of type <tt>T</tt> or possibly <tt>const | ||||
|       T</tt></td> | ||||
|     </tr> | ||||
|   </table> | ||||
|  | ||||
|   <h3>Definitions</h3> | ||||
|  | ||||
|   <h3>Valid expressions</h3> | ||||
|  | ||||
|   <table border summary=""> | ||||
|     <tr> | ||||
|       <th>Name</th> | ||||
|  | ||||
|       <th>Expression</th> | ||||
|  | ||||
|       <th>Return type</th> | ||||
|  | ||||
|       <th>Semantics</th> | ||||
|     </tr> | ||||
|  | ||||
|     <tr> | ||||
|       <td valign="top">Assignment</td> | ||||
|  | ||||
|       <td valign="top"><tt>t = u</tt></td> | ||||
|  | ||||
|       <td valign="top"><tt>T&</tt></td> | ||||
|  | ||||
|       <td valign="top"><tt>t</tt> is equivalent to <tt>u</tt></td> | ||||
|     </tr> | ||||
|   </table> | ||||
|  | ||||
|   <h3>Models</h3> | ||||
|  | ||||
|   <ul> | ||||
|     <li><tt>int</tt></li> | ||||
|  | ||||
|     <li><tt>std::pair</tt></li> | ||||
|   </ul> | ||||
|  | ||||
|   <h3>See also</h3> | ||||
|  | ||||
|   <p><a href= | ||||
|   "http://www.sgi.com/tech/stl/DefaultConstructible.html">DefaultConstructible</a> | ||||
|   and <a href="./CopyConstructible.html">CopyConstructible</a><br></p> | ||||
|   <hr> | ||||
|  | ||||
|   <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src= | ||||
|   "http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" | ||||
|   height="31" width="88"></a></p> | ||||
|  | ||||
|   <p>Revised  | ||||
|   <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->05 December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38516" --></p> | ||||
|  | ||||
|   <table summary=""> | ||||
|     <tr valign="top"> | ||||
|       <td nowrap><i>Copyright © 2000</i></td> | ||||
|  | ||||
|       <td><i><a href="http://www.lsc.nd.edu/~jsiek">Jeremy Siek</a>, Univ.of | ||||
|       Notre Dame (<a href= | ||||
|       "mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</a>)</i></td> | ||||
|     </tr> | ||||
|   </table> | ||||
|  | ||||
|   <p><i>Distributed under the Boost Software License, Version 1.0. (See | ||||
|   accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or | ||||
|   copy at <a href= | ||||
|   "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p> | ||||
| </body> | ||||
| </html> | ||||
|   | ||||
							
								
								
									
										1036
									
								
								Collection.html
									
									
									
									
									
								
							
							
						
						
									
										1036
									
								
								Collection.html
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,178 +1,139 @@ | ||||
| <HTML> | ||||
| <!-- | ||||
|   -- Copyright (c) Jeremy Siek 2000 | ||||
|   -- | ||||
|   -- Permission to use, copy, modify, distribute and sell this software | ||||
|   -- and its documentation for any purpose is hereby granted without fee, | ||||
|   -- provided that the above copyright notice appears in all copies and | ||||
|   -- that both that copyright notice and this permission notice appear | ||||
|   -- in supporting documentation.  Silicon Graphics makes no | ||||
|   -- representations about the suitability of this software for any | ||||
|   -- purpose.  It is provided "as is" without express or implied warranty. | ||||
|   --> | ||||
| <Head> | ||||
| <Title>Copy Constructible</Title> | ||||
| </HEAD> | ||||
| <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"  | ||||
|         ALINK="#ff0000">  | ||||
| <IMG SRC="../../c++boost.gif"  | ||||
|      ALT="C++ Boost" width="277" height="86">  | ||||
| <!--end header--> | ||||
| <BR Clear> | ||||
| <H1>Copy Constructible</H1> | ||||
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | ||||
|  | ||||
| <h3>Description</h3> | ||||
| A type is Copy Constructible if it is possible to copy objects of that | ||||
| type. | ||||
| <html> | ||||
| <head> | ||||
|   <meta http-equiv="Content-Language" content="en-us"> | ||||
|   <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> | ||||
|  | ||||
| <h3>Notation</h3> | ||||
| <Table> | ||||
| <TR> | ||||
| <TD VAlign=top> | ||||
| <tt>T</tt> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| is type that is a model of Copy Constructible | ||||
| </TD> | ||||
| </TR> | ||||
|   <title>Copy Constructible</title> | ||||
| </head> | ||||
|  | ||||
| <TR> | ||||
| <TD VAlign=top> | ||||
| <tt>t</tt> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| is an object of type <tt>T</tt> | ||||
| </TD> | ||||
| </tr> | ||||
| <body bgcolor="#FFFFFF" link="#0000EE" text="#000000" vlink="#551A8B" alink= | ||||
| "#FF0000"> | ||||
|   <img src="../../boost.png" alt="C++ Boost" width="277" height= | ||||
|   "86"><br clear="none"> | ||||
|  | ||||
| <TR> | ||||
| <TD VAlign=top> | ||||
| <tt>u</tt> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| is an object of type <tt>const T</tt> | ||||
| </TD> | ||||
| </tr> | ||||
|   <h1>Copy Constructible</h1> | ||||
|  | ||||
| </table> | ||||
| <h3>Definitions</h3> | ||||
| <h3>Valid expressions</h3> | ||||
| <Table border> | ||||
| <TR> | ||||
| <TH> | ||||
| Name | ||||
| </TH> | ||||
| <TH> | ||||
| Expression | ||||
| </TH> | ||||
| <TH> | ||||
| Return type | ||||
| </TH> | ||||
| <TH> | ||||
| Semantics | ||||
| </TH> | ||||
| </TR> | ||||
| <TR> | ||||
| <TD VAlign=top> | ||||
| Copy constructor | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <tt>T(t)</tt> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <tt>T</tt> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <tt>t</tt> is equivalent to <tt>T(t)</tt> | ||||
| </TD> | ||||
| </TR> | ||||
|   <h3>Description</h3> | ||||
|  | ||||
|   <p>A type is Copy Constructible if it is possible to copy objects of that | ||||
|   type.</p> | ||||
|  | ||||
| <TR> | ||||
| <TD VAlign=top> | ||||
| Copy constructor | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <pre> | ||||
|   <h3>Notation</h3> | ||||
|  | ||||
|   <table summary=""> | ||||
|     <tr> | ||||
|       <td valign="top"><tt>T</tt></td> | ||||
|  | ||||
|       <td valign="top">is type that is a model of Copy Constructible</td> | ||||
|     </tr> | ||||
|  | ||||
|     <tr> | ||||
|       <td valign="top"><tt>t</tt></td> | ||||
|  | ||||
|       <td valign="top">is an object of type <tt>T</tt></td> | ||||
|     </tr> | ||||
|  | ||||
|     <tr> | ||||
|       <td valign="top"><tt>u</tt></td> | ||||
|  | ||||
|       <td valign="top">is an object of type <tt>const T</tt></td> | ||||
|     </tr> | ||||
|   </table> | ||||
|  | ||||
|   <h3>Definitions</h3> | ||||
|  | ||||
|   <h3>Valid expressions</h3> | ||||
|  | ||||
|   <table border summary=""> | ||||
|     <tr> | ||||
|       <th>Name</th> | ||||
|  | ||||
|       <th>Expression</th> | ||||
|  | ||||
|       <th>Return type</th> | ||||
|  | ||||
|       <th>Semantics</th> | ||||
|     </tr> | ||||
|  | ||||
|     <tr> | ||||
|       <td valign="top">Copy constructor</td> | ||||
|  | ||||
|       <td valign="top"><tt>T(t)</tt></td> | ||||
|  | ||||
|       <td valign="top"><tt>T</tt></td> | ||||
|  | ||||
|       <td valign="top"><tt>t</tt> is equivalent to <tt>T(t)</tt></td> | ||||
|     </tr> | ||||
|  | ||||
|     <tr> | ||||
|       <td valign="top">Copy constructor</td> | ||||
|  | ||||
|       <td valign="top"> | ||||
|         <pre> | ||||
| T(u) | ||||
| </pre> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <tt>T</tt> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <tt>u</tt> is equivalent to <tt>T(u)</tt> | ||||
| </TD> | ||||
| </TR> | ||||
|       </td> | ||||
|  | ||||
|       <td valign="top"><tt>T</tt></td> | ||||
|  | ||||
| <TR> | ||||
| <TD VAlign=top> | ||||
| Destructor | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <pre> | ||||
|       <td valign="top"><tt>u</tt> is equivalent to <tt>T(u)</tt></td> | ||||
|     </tr> | ||||
|  | ||||
|     <tr> | ||||
|       <td valign="top">Destructor</td> | ||||
|  | ||||
|       <td valign="top"> | ||||
|         <pre> | ||||
| t.~T() | ||||
| </pre> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <tt>T</tt> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
|   | ||||
| </TD> | ||||
| </TR> | ||||
|       </td> | ||||
|  | ||||
| <TR> | ||||
| <TD VAlign=top> | ||||
| Address Operator | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <pre> | ||||
|       <td valign="top"><tt>T</tt></td> | ||||
|  | ||||
|       <td valign="top"> </td> | ||||
|     </tr> | ||||
|  | ||||
|     <tr> | ||||
|       <td valign="top">Address Operator</td> | ||||
|  | ||||
|       <td valign="top"> | ||||
|         <pre> | ||||
| &t | ||||
| </pre> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <tt>T*</tt> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| denotes the address of <tt>t</tt> | ||||
| </TD> | ||||
| </TR> | ||||
|       </td> | ||||
|  | ||||
| <TR> | ||||
| <TD VAlign=top> | ||||
| Address Operator | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <pre> | ||||
|       <td valign="top"><tt>T*</tt></td> | ||||
|  | ||||
|       <td valign="top">denotes the address of <tt>t</tt></td> | ||||
|     </tr> | ||||
|  | ||||
|     <tr> | ||||
|       <td valign="top">Address Operator</td> | ||||
|  | ||||
|       <td valign="top"> | ||||
|         <pre> | ||||
| &u | ||||
| </pre> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <tt>T*</tt> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| denotes the address of <tt>u</tt> | ||||
| </TD> | ||||
| </TR> | ||||
|       </td> | ||||
|  | ||||
|       <td valign="top"><tt>T*</tt></td> | ||||
|  | ||||
|       <td valign="top">denotes the address of <tt>u</tt></td> | ||||
|     </tr> | ||||
|   </table> | ||||
|  | ||||
| </table> | ||||
|   <h3>Models</h3> | ||||
|  | ||||
|   <ul> | ||||
|     <li><tt>int</tt></li> | ||||
|  | ||||
| </table> | ||||
| <h3>Models</h3> | ||||
|     <li><tt>std::pair</tt></li> | ||||
|   </ul> | ||||
|  | ||||
| <UL> | ||||
| <LI><tt>int</tt> | ||||
| <LI><tt>std::pair</tt> | ||||
| </UL> | ||||
|  | ||||
| <h3>Concept Checking Class</h3> | ||||
|  | ||||
| <pre> | ||||
|   <h3>Concept Checking Class</h3> | ||||
|   <pre> | ||||
|   template <class T> | ||||
|   struct CopyConstructibleConcept | ||||
|   { | ||||
| @@ -192,19 +153,33 @@ denotes the address of <tt>u</tt> | ||||
|   }; | ||||
| </pre> | ||||
|  | ||||
| <h3>See also</h3> | ||||
| <A | ||||
| href="http://www.sgi.com/tech/stl/DefaultConstructible.html">Default Constructible</A> | ||||
| and  | ||||
| <A hrefa="./Assignable.html">Assignable</A> | ||||
|   <h3>See also</h3> | ||||
|  | ||||
| <br> | ||||
| <HR> | ||||
| <TABLE> | ||||
| <TR valign=top> | ||||
| <TD nowrap>Copyright © 2000</TD><TD> | ||||
| <A HREF=http://www.lsc.nd.edu/~jsiek>Jeremy Siek</A>, Univ.of Notre Dame (<A HREF="mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</A>) | ||||
| </TD></TR></TABLE> | ||||
|   <p><a href="http://www.sgi.com/tech/stl/DefaultConstructible.html">Default | ||||
|   Constructible</a> and <a href="./Assignable.html">Assignable</a><br></p> | ||||
|   <hr> | ||||
|  | ||||
| </BODY> | ||||
| </HTML>  | ||||
|   <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src= | ||||
|   "http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" | ||||
|   height="31" width="88"></a></p> | ||||
|  | ||||
|   <p>Revised  | ||||
|   <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->05 | ||||
|   December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38516" --></p> | ||||
|  | ||||
|   <table summary=""> | ||||
|     <tr valign="top"> | ||||
|       <td nowrap><i>Copyright © 2000</i></td> | ||||
|  | ||||
|       <td><i><a href="http://www.lsc.nd.edu/~jsiek">Jeremy Siek</a>, Univ.of | ||||
|       Notre Dame (<a href= | ||||
|       "mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</a>)</i></td> | ||||
|     </tr> | ||||
|   </table> | ||||
|  | ||||
|   <p><i>Distributed under the Boost Software License, Version 1.0. (See | ||||
|   accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or | ||||
|   copy at <a href= | ||||
|   "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p> | ||||
| </body> | ||||
| </html> | ||||
|   | ||||
| @@ -1,212 +1,210 @@ | ||||
| <HTML> | ||||
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | ||||
|  | ||||
| <html> | ||||
| <!-- | ||||
|   -- Copyright (c) Jeremy Siek 2000 | ||||
|   -- | ||||
|   -- Permission to use, copy, modify, distribute and sell this software | ||||
|   -- and its documentation for any purpose is hereby granted without fee, | ||||
|   -- provided that the above copyright notice appears in all copies and | ||||
|   -- that both that copyright notice and this permission notice appear | ||||
|   -- in supporting documentation.  Silicon Graphics makes no | ||||
|   -- representations about the suitability of this software for any | ||||
|   -- purpose.  It is provided "as is" without express or implied warranty. | ||||
|   == Copyright (c) 1996-1999 | ||||
|   == Silicon Graphics Computer Systems, Inc. | ||||
|   == | ||||
|   == Permission to use, copy, modify, distribute and sell this software | ||||
|   == and its documentation for any purpose is hereby granted without fee, | ||||
|   == provided that the above copyright notice appears in all copies and | ||||
|   == that both that copyright notice and this permission notice appear | ||||
|   == in supporting documentation.  Silicon Graphics makes no | ||||
|   == representations about the suitability of this software for any | ||||
|   == purpose.  It is provided "as is" without express or implied warranty. | ||||
|   == | ||||
|   == Copyright (c) 1994 | ||||
|   == Hewlett-Packard Company | ||||
|   == | ||||
|   == Permission to use, copy, modify, distribute and sell this software | ||||
|   == and its documentation for any purpose is hereby granted without fee, | ||||
|   == provided that the above copyright notice appears in all copies and | ||||
|   == that both that copyright notice and this permission notice appear | ||||
|   == in supporting documentation.  Hewlett-Packard Company makes no | ||||
|   == representations about the suitability of this software for any | ||||
|   == purpose.  It is provided "as is" without express or implied warranty. | ||||
|   == | ||||
|   --> | ||||
| <!-- | ||||
|   -- Copyright (c) 1996-1999 | ||||
|   -- Silicon Graphics Computer Systems, Inc. | ||||
|   -- | ||||
|   -- Permission to use, copy, modify, distribute and sell this software | ||||
|   -- and its documentation for any purpose is hereby granted without fee, | ||||
|   -- provided that the above copyright notice appears in all copies and | ||||
|   -- that both that copyright notice and this permission notice appear | ||||
|   -- in supporting documentation.  Silicon Graphics makes no | ||||
|   -- representations about the suitability of this software for any | ||||
|   -- purpose.  It is provided "as is" without express or implied warranty. | ||||
|   -- | ||||
|   -- Copyright (c) 1994 | ||||
|   -- Hewlett-Packard Company | ||||
|   -- | ||||
|   -- Permission to use, copy, modify, distribute and sell this software | ||||
|   -- and its documentation for any purpose is hereby granted without fee, | ||||
|   -- provided that the above copyright notice appears in all copies and | ||||
|   -- that both that copyright notice and this permission notice appear | ||||
|   -- in supporting documentation.  Hewlett-Packard Company makes no | ||||
|   -- representations about the suitability of this software for any | ||||
|   -- purpose.  It is provided "as is" without express or implied warranty. | ||||
|   -- | ||||
|   --> | ||||
| <Head> | ||||
| <Title>LessThanComparable</Title> | ||||
| </Head> | ||||
| <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"  | ||||
|         ALINK="#ff0000">  | ||||
| <IMG SRC="../../c++boost.gif"  | ||||
|      ALT="C++ Boost" width="277" height="86">  | ||||
| <!--end header--> | ||||
| <BR Clear> | ||||
| <H1>LessThanComparable</H1> | ||||
|  | ||||
| <h3>Description</h3> | ||||
| A type is LessThanComparable if it is ordered: it must | ||||
| be possible to compare two objects of that type using <tt>operator<</tt>, and | ||||
| <tt>operator<</tt> must be a strict weak ordering relation. | ||||
| <head> | ||||
|   <meta http-equiv="Content-Language" content="en-us"> | ||||
|   <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> | ||||
|  | ||||
|   <title>LessThanComparable</title> | ||||
| </head> | ||||
|  | ||||
| <h3>Refinement of</h3> | ||||
| <h3>Associated types</h3> | ||||
| <h3>Notation</h3> | ||||
| <Table> | ||||
| <TR> | ||||
| <TD VAlign=top> | ||||
| <tt>X</tt> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| A type that is a model of LessThanComparable | ||||
| </TD> | ||||
| </TR> | ||||
| <TR> | ||||
| <TD VAlign=top> | ||||
| <tt>x</tt>, <tt>y</tt>, <tt>z</tt> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| Object of type <tt>X</tt> | ||||
| </TD> | ||||
| </tr> | ||||
| </table> | ||||
| <h3>Definitions</h3> | ||||
| Consider the relation <tt>!(x < y) && !(y < x)</tt>.  If this relation is | ||||
| transitive (that is, if <tt>!(x < y) && !(y < x) && !(y < z) && !(z < y)</tt> | ||||
| implies <tt>!(x < z) && !(z < x)</tt>), then it satisfies the mathematical | ||||
| definition of an equivalence relation.  In this case, <tt>operator<</tt> | ||||
| is a <i>strict weak ordering</i>. | ||||
| <P> | ||||
| If <tt>operator<</tt> is a strict weak ordering, and if each equivalence class | ||||
| has only a single element, then <tt>operator<</tt> is a <i>total ordering</i>. | ||||
| <h3>Valid expressions</h3> | ||||
| <Table border> | ||||
| <TR> | ||||
| <TH> | ||||
| Name | ||||
| </TH> | ||||
| <TH> | ||||
| Expression | ||||
| </TH> | ||||
| <TH> | ||||
| Type requirements | ||||
| </TH> | ||||
| <TH> | ||||
| Return type | ||||
| </TH> | ||||
| </TR> | ||||
| <TR> | ||||
| <TD VAlign=top> | ||||
| Less | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <tt>x < y</tt> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
|   | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| Convertible to <tt>bool</tt> | ||||
| </TD> | ||||
| </TR> | ||||
| </table> | ||||
| <body bgcolor="#FFFFFF" link="#0000EE" text="#000000" vlink="#551A8B" alink= | ||||
| "#FF0000"> | ||||
|   <img src="../../boost.png" alt="C++ Boost" width="277" height= | ||||
|   "86"><br clear="none"> | ||||
|  | ||||
|   <h1>LessThanComparable</h1> | ||||
|  | ||||
|   <h3>Description</h3> | ||||
|  | ||||
| <h3>Expression semantics</h3> | ||||
| <Table border> | ||||
| <TR> | ||||
| <TH> | ||||
| Name | ||||
| </TH> | ||||
| <TH> | ||||
| Expression | ||||
| </TH> | ||||
| <TH> | ||||
| Precondition | ||||
| </TH> | ||||
| <TH> | ||||
| Semantics | ||||
| </TH> | ||||
| <TH> | ||||
| Postcondition | ||||
| </TH> | ||||
| </TR> | ||||
| <TR> | ||||
| <TD VAlign=top> | ||||
| Less | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <tt>x < y</tt> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <tt>x</tt> and <tt>y</tt> are in the domain of <tt><</tt> | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
|   | ||||
| </TD> | ||||
| </table> | ||||
|   <p>A type is LessThanComparable if it is ordered: it must be possible to | ||||
|   compare two objects of that type using <tt>operator<</tt>, and | ||||
|   <tt>operator<</tt> must be a strict weak ordering relation.</p> | ||||
|  | ||||
|   <h3>Refinement of</h3> | ||||
|  | ||||
| <h3>Complexity guarantees</h3> | ||||
| <h3>Invariants</h3> | ||||
| <Table border> | ||||
| <TR> | ||||
| <TD VAlign=top> | ||||
| Irreflexivity | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <tt>x < x</tt> must be false. | ||||
| </TD> | ||||
| </TR> | ||||
| <TR> | ||||
| <TD VAlign=top> | ||||
| Antisymmetry | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <tt>x < y</tt> implies !(y < x) <A href="#2">[2]</A> | ||||
| </TD> | ||||
| </TR> | ||||
| <TR> | ||||
| <TD VAlign=top> | ||||
| Transitivity | ||||
| </TD> | ||||
| <TD VAlign=top> | ||||
| <tt>x < y</tt> and <tt>y < z</tt> implies <tt>x < z</tt> <A href="#3">[3]</A> | ||||
| </TD> | ||||
| </tr> | ||||
| </table> | ||||
| <h3>Models</h3> | ||||
| <UL> | ||||
| <LI> | ||||
| int | ||||
| </UL> | ||||
| <h3>Notes</h3> | ||||
| <P><A name="1">[1]</A> | ||||
| Only <tt>operator<</tt> is fundamental; the other inequality operators | ||||
| are essentially syntactic sugar. | ||||
| <P><A name="2">[2]</A> | ||||
| Antisymmetry is a theorem, not an axiom: it follows from | ||||
| irreflexivity and transitivity. | ||||
| <P><A name="3">[3]</A> | ||||
| Because of irreflexivity and transitivity, <tt>operator<</tt> always | ||||
| satisfies the definition of a <i>partial ordering</i>.  The definition of | ||||
| a <i>strict weak ordering</i> is stricter, and the definition of a | ||||
| <i>total ordering</i> is stricter still. | ||||
| <h3>See also</h3> | ||||
| <A href="http://www.sgi.com/tech/stl/EqualityComparable.html">EqualityComparable</A>, <A href="http://www.sgi.com/tech/stl/StrictWeakOrdering.html">StrictWeakOrdering</A> | ||||
|   <h3>Associated types</h3> | ||||
|  | ||||
|   <h3>Notation</h3> | ||||
|  | ||||
|   <table summary=""> | ||||
|     <tr> | ||||
|       <td valign="top"><tt>X</tt></td> | ||||
|  | ||||
| <br> | ||||
| <HR> | ||||
| <TABLE> | ||||
| <TR valign=top> | ||||
| <TD nowrap>Copyright © 2000</TD><TD> | ||||
| <A HREF=http://www.lsc.nd.edu/~jsiek>Jeremy Siek</A>, Univ.of Notre Dame (<A HREF="mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</A>) | ||||
| </TD></TR></TABLE> | ||||
|       <td valign="top">A type that is a model of LessThanComparable</td> | ||||
|     </tr> | ||||
|  | ||||
| </BODY> | ||||
| </HTML>  | ||||
|     <tr> | ||||
|       <td valign="top"><tt>x</tt>, <tt>y</tt>, <tt>z</tt></td> | ||||
|  | ||||
|       <td valign="top">Object of type <tt>X</tt></td> | ||||
|     </tr> | ||||
|   </table> | ||||
|  | ||||
|   <h3>Definitions</h3> | ||||
|  | ||||
|   <p>Consider the relation <tt>!(x < y) && !(y < x)</tt>. If | ||||
|   this relation is transitive (that is, if <tt>!(x < y) && !(y | ||||
|   < x) && !(y < z) && !(z < y)</tt> implies <tt>!(x | ||||
|   < z) && !(z < x)</tt>), then it satisfies the mathematical | ||||
|   definition of an equivalence relation. In this case, <tt>operator<</tt> | ||||
|   is a <i>strict weak ordering</i>.</p> | ||||
|  | ||||
|   <p>If <tt>operator<</tt> is a strict weak ordering, and if each | ||||
|   equivalence class has only a single element, then <tt>operator<</tt> is | ||||
|   a <i>total ordering</i>.</p> | ||||
|  | ||||
|   <h3>Valid expressions</h3> | ||||
|  | ||||
|   <table border summary=""> | ||||
|     <tr> | ||||
|       <th>Name</th> | ||||
|  | ||||
|       <th>Expression</th> | ||||
|  | ||||
|       <th>Type requirements</th> | ||||
|  | ||||
|       <th>Return type</th> | ||||
|     </tr> | ||||
|  | ||||
|     <tr> | ||||
|       <td valign="top">Less</td> | ||||
|  | ||||
|       <td valign="top"><tt>x < y</tt></td> | ||||
|  | ||||
|       <td valign="top"> </td> | ||||
|  | ||||
|       <td valign="top">Convertible to <tt>bool</tt></td> | ||||
|     </tr> | ||||
|   </table> | ||||
|  | ||||
|   <h3>Expression semantics</h3> | ||||
|  | ||||
|   <table border summary=""> | ||||
|     <tr> | ||||
|       <th>Name</th> | ||||
|  | ||||
|       <th>Expression</th> | ||||
|  | ||||
|       <th>Precondition</th> | ||||
|  | ||||
|       <th>Semantics</th> | ||||
|  | ||||
|       <th>Postcondition</th> | ||||
|     </tr> | ||||
|  | ||||
|     <tr> | ||||
|       <td valign="top">Less</td> | ||||
|  | ||||
|       <td valign="top"><tt>x < y</tt></td> | ||||
|  | ||||
|       <td valign="top"><tt>x</tt> and <tt>y</tt> are in the domain of | ||||
|       <tt><</tt></td> | ||||
|  | ||||
|       <td valign="top"> </td> | ||||
|     </tr> | ||||
|   </table> | ||||
|  | ||||
|   <h3>Complexity guarantees</h3> | ||||
|  | ||||
|   <h3>Invariants</h3> | ||||
|  | ||||
|   <table border summary=""> | ||||
|     <tr> | ||||
|       <td valign="top">Irreflexivity</td> | ||||
|  | ||||
|       <td valign="top"><tt>x < x</tt> must be false.</td> | ||||
|     </tr> | ||||
|  | ||||
|     <tr> | ||||
|       <td valign="top">Antisymmetry</td> | ||||
|  | ||||
|       <td valign="top"><tt>x < y</tt> implies !(y < x) <a href= | ||||
|       "#n2">[2]</a></td> | ||||
|     </tr> | ||||
|  | ||||
|     <tr> | ||||
|       <td valign="top">Transitivity</td> | ||||
|  | ||||
|       <td valign="top"><tt>x < y</tt> and <tt>y < z</tt> implies <tt>x | ||||
|       < z</tt> <a href="#n3">[3]</a></td> | ||||
|     </tr> | ||||
|   </table> | ||||
|  | ||||
|   <h3>Models</h3> | ||||
|  | ||||
|   <ul> | ||||
|     <li>int</li> | ||||
|   </ul> | ||||
|  | ||||
|   <h3>Notes</h3> | ||||
|  | ||||
|   <p><a name="n1" id="n1">[1]</a> Only <tt>operator<</tt> is fundamental; | ||||
|   the other inequality operators are essentially syntactic sugar.</p> | ||||
|  | ||||
|   <p><a name="n2" id="n2">[2]</a> Antisymmetry is a theorem, not an axiom: it | ||||
|   follows from irreflexivity and transitivity.</p> | ||||
|  | ||||
|   <p><a name="n3" id="n3">[3]</a> Because of irreflexivity and transitivity, | ||||
|   <tt>operator<</tt> always satisfies the definition of a <i>partial | ||||
|   ordering</i>. The definition of a <i>strict weak ordering</i> is stricter, | ||||
|   and the definition of a <i>total ordering</i> is stricter still.</p> | ||||
|  | ||||
|   <h3>See also</h3> | ||||
|  | ||||
|   <p><a href= | ||||
|   "http://www.sgi.com/tech/stl/EqualityComparable.html">EqualityComparable</a>, | ||||
|   <a href= | ||||
|   "http://www.sgi.com/tech/stl/StrictWeakOrdering.html">StrictWeakOrdering</a><br> | ||||
|   </p> | ||||
|   <hr> | ||||
|  | ||||
|   <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src= | ||||
|   "http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" | ||||
|   height="31" width="88"></a></p> | ||||
|  | ||||
|   <p>Revised  | ||||
|   <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->05 | ||||
|   December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38516" --></p> | ||||
|  | ||||
|   <table summary=""> | ||||
|     <tr valign="top"> | ||||
|       <td nowrap><i>Copyright © 2000</i></td> | ||||
|  | ||||
|       <td><i><a href="http://www.lsc.nd.edu/~jsiek">Jeremy Siek</a>, Univ.of | ||||
|       Notre Dame (<a href= | ||||
|       "mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</a>)</i></td> | ||||
|     </tr> | ||||
|   </table> | ||||
|  | ||||
|   <p><i>Distributed under the Boost Software License, Version 1.0. (See | ||||
|   accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or | ||||
|   copy at <a href= | ||||
|   "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p> | ||||
| </body> | ||||
| </html> | ||||
|   | ||||
| @@ -1,92 +1,95 @@ | ||||
| <HTML> | ||||
| <!-- | ||||
|   -- Copyright (c) Jeremy Siek 2000 | ||||
|   -- | ||||
|   -- Permission to use, copy, modify, distribute and sell this software | ||||
|   -- and its documentation for any purpose is hereby granted without fee, | ||||
|   -- provided that the above copyright notice appears in all copies and | ||||
|   -- that both that copyright notice and this permission notice appear | ||||
|   -- in supporting documentation.  Silicon Graphics makes no | ||||
|   -- representations about the suitability of this software for any | ||||
|   -- purpose.  It is provided "as is" without express or implied warranty. | ||||
|   --> | ||||
| <Head> | ||||
| <Title>MultiPassInputIterator</Title> | ||||
| <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"  | ||||
| 	ALINK="#ff0000">  | ||||
| <IMG SRC="../../c++boost.gif"  | ||||
|      ALT="C++ Boost" width="277" height="86">  | ||||
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | ||||
|  | ||||
| <BR Clear> | ||||
| <html> | ||||
| <head> | ||||
|   <meta http-equiv="Content-Language" content="en-us"> | ||||
|   <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> | ||||
|  | ||||
| <H2> | ||||
| <A NAME="concept:MultiPassInputIterator"></A> | ||||
| Multi-Pass Input Iterator | ||||
| </H2> | ||||
|   <title>MultiPassInputIterator</title> | ||||
| </head> | ||||
|  | ||||
| This concept is a refinement of <a | ||||
| href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>, | ||||
| adding the requirements that the iterator can be used to make multiple | ||||
| passes through a range, and that if <TT>it1 == it2</TT> and | ||||
| <TT>it1</TT> is dereferenceable then <TT>++it1 == ++it2</TT>. The | ||||
| Multi-Pass Input Iterator is very similar to the <a | ||||
| href="http://www.sgi.com/tech/stl/ForwardIterator.hmtl">Forward Iterator</a>. The | ||||
| only difference is that a <a | ||||
| href="http://www.sgi.com/tech/stl/ForwardIterator.hmtl">Forward Iterator</a> | ||||
| requires the <TT>reference</TT> type to be <TT>value_type&</TT>, whereas | ||||
| MultiPassInputIterator is like <a | ||||
| href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> | ||||
| in that the <TT>reference</TT> type merely has to be convertible to | ||||
| <TT>value_type</TT>. | ||||
| <body bgcolor="#FFFFFF" link="#0000EE" text="#000000" vlink="#551A8B" alink= | ||||
| "#FF0000"> | ||||
|   <img src="../../boost.png" alt="C++ Boost" width="277" height= | ||||
|   "86"><br clear="none"> | ||||
|  | ||||
|   <h2><a name="concept:MultiPassInputIterator" id= | ||||
|   "concept:MultiPassInputIterator"></a> Multi-Pass Input Iterator</h2> | ||||
|  | ||||
| <h3>Design Notes</h3> | ||||
|   <p>This concept is a refinement of <a href= | ||||
|   "http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>, adding | ||||
|   the requirements that the iterator can be used to make multiple passes | ||||
|   through a range, and that if <tt>it1 == it2</tt> and <tt>it1</tt> is | ||||
|   dereferenceable then <tt>++it1 == ++it2</tt>. The Multi-Pass Input Iterator | ||||
|   is very similar to the <a href= | ||||
|   "http://www.sgi.com/tech/stl/ForwardIterator.html">Forward Iterator</a>. | ||||
|   The only difference is that a <a href= | ||||
|   "http://www.sgi.com/tech/stl/ForwardIterator.html">Forward Iterator</a> | ||||
|   requires the <tt>reference</tt> type to be <tt>value_type&</tt>, | ||||
|   whereas MultiPassInputIterator is like <a href= | ||||
|   "http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> in that | ||||
|   the <tt>reference</tt> type merely has to be convertible to | ||||
|   <tt>value_type</tt>.</p> | ||||
|  | ||||
| comments by Valentin Bonnard: | ||||
|   <h3>Design Notes</h3> | ||||
|  | ||||
| <p> I think that introducing Multi-Pass Input Iterator isn't the right | ||||
| solution. Do you also want to define Multi-Pass Bidirectionnal Iterator | ||||
| and Multi-Pass Random Access Iterator ? I don't, definitly. It only | ||||
| confuses the issue. The problem lies into the existing hierarchy of | ||||
| iterators, which mixes movabillity, modifiabillity and lvalue-ness, | ||||
| and these are clearly independant. | ||||
|   <p>comments by Valentin Bonnard:</p> | ||||
|  | ||||
| <p> The terms Forward, Bidirectionnal and Random Access are about | ||||
| movabillity and shouldn't be used to mean anything else.  In a | ||||
| completly orthogonal way, iterators can be immutable, mutable, or | ||||
| neither.  Lvalueness of iterators is also orthogonal with | ||||
| immutabillity.  With these clean concepts, your Multi-Pass Input Iterator | ||||
| is just called a Forward Iterator. | ||||
|   <p>I think that introducing Multi-Pass Input Iterator isn't the right | ||||
|   solution. Do you also want to define Multi-Pass Bidirectionnal Iterator and | ||||
|   Multi-Pass Random Access Iterator ? I don't, definitly. It only confuses | ||||
|   the issue. The problem lies into the existing hierarchy of iterators, which | ||||
|   mixes movabillity, modifiabillity and lvalue-ness, and these are clearly | ||||
|   independant.</p> | ||||
|  | ||||
| <p>                 | ||||
| Other translations are:<br> | ||||
| std::Forward Iterator -> ForwardIterator & Lvalue Iterator<br> | ||||
| std::Bidirectionnal Iterator -> Bidirectionnal Iterator & Lvalue Iterator<br> | ||||
| std::Random Access Iterator -> Random Access Iterator & Lvalue Iterator<br> | ||||
|   <p>The terms Forward, Bidirectionnal and Random Access are about | ||||
|   movabillity and shouldn't be used to mean anything else. In a completly | ||||
|   orthogonal way, iterators can be immutable, mutable, or neither. Lvalueness | ||||
|   of iterators is also orthogonal with immutabillity. With these clean | ||||
|   concepts, your Multi-Pass Input Iterator is just called a Forward | ||||
|   Iterator.</p> | ||||
|  | ||||
| <p> | ||||
| Note that in practice the only operation not allowed on my  | ||||
| Forward Iterator which is allowed on std::Forward Iterator is  | ||||
| <tt>&*it</tt>. I think that <tt>&*</tt> is rarely needed in generic code. | ||||
|   <p>Other translations are:<br> | ||||
|   std::Forward Iterator -> ForwardIterator & Lvalue Iterator<br> | ||||
|   std::Bidirectionnal Iterator -> Bidirectionnal Iterator & Lvalue | ||||
|   Iterator<br> | ||||
|   std::Random Access Iterator -> Random Access Iterator & Lvalue | ||||
|   Iterator<br></p> | ||||
|  | ||||
| <p> | ||||
| reply by Jeremy Siek: | ||||
|   <p>Note that in practice the only operation not allowed on my Forward | ||||
|   Iterator which is allowed on std::Forward Iterator is <tt>&*it</tt>. I | ||||
|   think that <tt>&*</tt> is rarely needed in generic code.</p> | ||||
|  | ||||
| <p> | ||||
| The above analysis by Valentin is right on. Of course, there is | ||||
| the problem with backward compatibility. The current STL implementations | ||||
| are based on the old definition of Forward Iterator. The right course | ||||
| of action is to get Forward Iterator, etc. changed in the C++ standard. | ||||
| Once that is done we can drop Multi-Pass Input Iterator. | ||||
|   <p>reply by Jeremy Siek:</p> | ||||
|  | ||||
|   <p>The above analysis by Valentin is right on. Of course, there is the | ||||
|   problem with backward compatibility. The current STL implementations are | ||||
|   based on the old definition of Forward Iterator. The right course of action | ||||
|   is to get Forward Iterator, etc. changed in the C++ standard. Once that is | ||||
|   done we can drop Multi-Pass Input Iterator.<br></p> | ||||
|   <hr> | ||||
|  | ||||
| <br> | ||||
| <HR> | ||||
| <TABLE> | ||||
| <TR valign=top> | ||||
| <TD nowrap>Copyright © 2000</TD><TD> | ||||
| <a HREF="../../people/jeremy_siek.htm">Jeremy Siek</a>, Univ.of Notre Dame (<A HREF="mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</A>) | ||||
| </TD></TR></TABLE> | ||||
|   <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src= | ||||
|   "http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" | ||||
|   height="31" width="88"></a></p> | ||||
|  | ||||
| </BODY> | ||||
| </HTML>  | ||||
|   <p>Revised  | ||||
|   <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->05 | ||||
|   December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38516" --></p> | ||||
|  | ||||
|   <table summary=""> | ||||
|     <tr valign="top"> | ||||
|       <td nowrap><i>Copyright © 2000</i></td> | ||||
|  | ||||
|       <td><i><a href="http://www.lsc.nd.edu/~jsiek">Jeremy Siek</a>, Univ.of | ||||
|       Notre Dame (<a href= | ||||
|       "mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</a>)</i></td> | ||||
|     </tr> | ||||
|   </table> | ||||
|  | ||||
|   <p><i>Distributed under the Boost Software License, Version 1.0. (See | ||||
|   accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or | ||||
|   copy at <a href= | ||||
|   "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p> | ||||
| </body> | ||||
| </html> | ||||
|   | ||||
| @@ -4,7 +4,7 @@ | ||||
| </HEAD> | ||||
| <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"  | ||||
|         ALINK="#ff0000">  | ||||
| <IMG SRC="../../c++boost.gif"  | ||||
| <IMG SRC="../../boost.png"  | ||||
|      ALT="C++ Boost" width="277" height="86">  | ||||
| <!--end header--> | ||||
| <BR Clear> | ||||
|   | ||||
| @@ -1,46 +1,94 @@ | ||||
| // Copyright (C) 2002 Brad King (brad.king@kitware.com)  | ||||
| //                    Doug Gregor (gregod@cs.rpi.edu) | ||||
| //                    Douglas 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. | ||||
| // Distributed under the Boost Software License, Version 1.0. (See | ||||
| // accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
|  | ||||
| // For more information, see http://www.boost.org | ||||
|  | ||||
| #define BOOST_INCLUDE_MAIN | ||||
| #include <boost/test/test_tools.hpp> | ||||
| #include <boost/utility.hpp> | ||||
|  | ||||
| #include <boost/utility/addressof.hpp> | ||||
|  | ||||
| #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) | ||||
| #pragma warning(push, 3) | ||||
| #endif | ||||
|  | ||||
| #include <iostream> | ||||
|  | ||||
| #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) | ||||
| #pragma warning(pop) | ||||
| #endif | ||||
|  | ||||
| #include <boost/detail/lightweight_test.hpp> | ||||
|  | ||||
| template<class T> void scalar_test( T * = 0 ) | ||||
| { | ||||
|     T* px = new T(); | ||||
|  | ||||
|     T& x = *px; | ||||
|     BOOST_TEST( boost::addressof(x) == px ); | ||||
|  | ||||
|     const T& cx = *px; | ||||
|     const T* pcx = boost::addressof(cx); | ||||
|     BOOST_TEST( pcx == px ); | ||||
|  | ||||
|     volatile T& vx = *px; | ||||
|     volatile T* pvx = boost::addressof(vx); | ||||
|     BOOST_TEST( pvx == px ); | ||||
|  | ||||
|     const volatile T& cvx = *px; | ||||
|     const volatile T* pcvx = boost::addressof(cvx); | ||||
|     BOOST_TEST( pcvx == px ); | ||||
|  | ||||
|     delete px; | ||||
| } | ||||
|  | ||||
| template<class T> void array_test( T * = 0 ) | ||||
| { | ||||
|     T nrg[3] = {1,2,3}; | ||||
|     T (*pnrg)[3] = &nrg; | ||||
|     BOOST_TEST( boost::addressof(nrg) == pnrg ); | ||||
|  | ||||
|     T const cnrg[3] = {1,2,3}; | ||||
|     T const (*pcnrg)[3] = &cnrg; | ||||
|     BOOST_TEST( boost::addressof(cnrg) == pcnrg ); | ||||
| } | ||||
|  | ||||
| struct addressable | ||||
| { | ||||
|     addressable( int = 0 ) | ||||
|     { | ||||
|     } | ||||
| }; | ||||
|  | ||||
| struct useless_type {}; | ||||
|  | ||||
| class nonaddressable { | ||||
| public: | ||||
|   void dummy(); // Silence GCC warning: all member of class are private | ||||
|  | ||||
|     nonaddressable( int = 0 ) | ||||
|     { | ||||
|     } | ||||
|  | ||||
|     void dummy(); // Silence GCC warning: all member of class are private | ||||
|  | ||||
| private: | ||||
|   useless_type operator&() const; | ||||
|  | ||||
|     useless_type operator&() const; | ||||
| }; | ||||
|  | ||||
| int test_main(int, char*[]) | ||||
| int main() | ||||
| { | ||||
|   nonaddressable* px = new nonaddressable(); | ||||
|     scalar_test<char>(); | ||||
|     scalar_test<int>(); | ||||
|     scalar_test<addressable>(); | ||||
|     scalar_test<nonaddressable>(); | ||||
|  | ||||
|   nonaddressable& x = *px; | ||||
|   BOOST_TEST(boost::addressof(x) == px); | ||||
|     array_test<char>(); | ||||
|     array_test<int>(); | ||||
|     array_test<addressable>(); | ||||
|     array_test<nonaddressable>(); | ||||
|  | ||||
|   const nonaddressable& cx = *px; | ||||
|   BOOST_TEST(boost::addressof(cx) == static_cast<const nonaddressable*>(px)); | ||||
|  | ||||
|   volatile nonaddressable& vx = *px; | ||||
|   BOOST_TEST(boost::addressof(vx) == static_cast<volatile nonaddressable*>(px)); | ||||
|  | ||||
|   const volatile nonaddressable& cvx = *px; | ||||
|   BOOST_TEST(boost::addressof(cvx) == static_cast<const volatile nonaddressable*>(px)); | ||||
|    | ||||
|   return 0; | ||||
|     return boost::report_errors(); | ||||
| } | ||||
|   | ||||
							
								
								
									
										12
									
								
								assert.html
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								assert.html
									
									
									
									
									
								
							| @@ -7,10 +7,9 @@ | ||||
| 	<body bgcolor="white" style="MARGIN-LEFT: 5%; MARGIN-RIGHT: 5%"> | ||||
| 		<table border="0" width="100%"> | ||||
| 			<tr> | ||||
| 				<td width="277"> | ||||
| 					<img src="../../c++boost.gif" alt="c++boost.gif (8819 bytes)" width="277" height="86"> | ||||
| 				<td width="277"><A href="../../index.htm"> <img src="../../boost.png" alt="boost.png (6897 bytes)" width="277" height="86" border="0"></A> | ||||
| 				</td> | ||||
| 				<td align="middle"> | ||||
| 				<td align="center"> | ||||
| 					<h1>assert.hpp</h1> | ||||
| 				</td> | ||||
| 			</tr> | ||||
| @@ -49,9 +48,8 @@ void assertion_failed(char const * expr, char const * function, char const * fil | ||||
| 			can be included multiple times in a single translation unit. <STRONG>BOOST_ASSERT</STRONG> | ||||
| 			will be redefined each time as specified above.</P> | ||||
| 		<p><br> | ||||
| 			<small>Copyright <20> 2002 by Peter Dimov. Permission to copy, use, modify, sell and  | ||||
| 				distribute this document is granted provided this copyright notice appears in  | ||||
| 				all copies. This document is provided "as is" without express or implied  | ||||
| 				warranty, and with no claim as to its suitability for any purpose.</small></p> | ||||
| 			<small>Copyright <20> 2002 by Peter Dimov. Distributed under the Boost Software License, Version  | ||||
| 				1.0. See accompanying file <A href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</A> or  | ||||
| 				copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>.</small></p> | ||||
| 	</body> | ||||
| </html> | ||||
|   | ||||
| @@ -3,10 +3,9 @@ | ||||
| // | ||||
| //  Copyright (c) 2002 Peter Dimov and Multi Media Ltd. | ||||
| // | ||||
| //  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. | ||||
| // Distributed under the Boost Software License, Version 1.0. (See | ||||
| // accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
|  | ||||
| #include <boost/detail/lightweight_test.hpp> | ||||
| @@ -52,13 +51,18 @@ void test_disabled() | ||||
|  | ||||
| #define BOOST_ENABLE_ASSERT_HANDLER | ||||
| #include <boost/assert.hpp> | ||||
| #include <boost/config.hpp> | ||||
| #include <cstdio> | ||||
|  | ||||
| int handler_invoked = 0; | ||||
|  | ||||
| void boost::assertion_failed(char const * expr, char const * function, char const * file, long line) | ||||
| { | ||||
|     std::printf("Expression: %s\nFunction: %s\nFile: %s\nLine: %ld\n\n", expr, function, file, line); | ||||
| #if !defined(BOOST_NO_STDC_NAMESPACE) | ||||
|     using std::printf; | ||||
| #endif | ||||
|  | ||||
|     printf("Expression: %s\nFunction: %s\nFile: %s\nLine: %ld\n\n", expr, function, file, line); | ||||
|     ++handler_invoked; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -5,15 +5,14 @@ | ||||
| </head> | ||||
|  | ||||
| <body bgcolor="white" link="blue" text="black" vlink="purple" alink="red">  | ||||
| <h1><img src="../../c++boost.gif" alt="C++ Boost" align="middle" | ||||
| <h1><img src="../../boost.png" alt="C++ Boost" align="middle" | ||||
| width="277" height="86">Base-from-Member Idiom</h1> | ||||
|  | ||||
| <p>The class template <code>boost::base_from_member</code> provides | ||||
| a workaround for a class that needs to initialize a base class with a | ||||
| member.  The class template is in <cite><a | ||||
| href="../../boost/utility/base_from_member.hpp">boost/utility/base_from_member.hpp</a></cite> | ||||
| which is included in <i><a href="../../boost/utility.hpp">boost/utility.hpp</a></i>. | ||||
| The class template is forward declared in <i><a href="../../boost/utility_fwd.hpp">boost/utility_fwd.hpp</a></i>.</p> | ||||
| which is included in <i><a href="../../boost/utility.hpp">boost/utility.hpp</a></i>.</p> | ||||
|  | ||||
| <p>There is test/example code in <cite><a | ||||
| href="base_from_member_test.cpp">base_from_member_test.cpp</a></cite>.</p> | ||||
| @@ -130,6 +129,10 @@ particular member type does not need to concern itself with the integer.</p> | ||||
| <h2><a name="synopsis">Synopsis</a></h2> | ||||
|  | ||||
| <blockquote><pre> | ||||
| #ifndef BOOST_BASE_FROM_MEMBER_MAX_ARITY | ||||
| #define BOOST_BASE_FROM_MEMBER_MAX_ARITY  10 | ||||
| #endif | ||||
|  | ||||
| template < typename MemberType, int UniqueID = 0 > | ||||
| class boost::base_from_member | ||||
| { | ||||
| @@ -171,6 +174,14 @@ the template parameters of a templated constructor, make sure that | ||||
| the arguments are already close as possible to the actual type used in | ||||
| the data member's desired constructor.</p> | ||||
|  | ||||
| <p>The <var>BOOST_BASE_FROM_MEMBER_MAX_ARITY</var> macro constant specifies | ||||
| the maximum argument length for the constructor templates.  The constant | ||||
| may be overridden if more (or less) argument configurations are needed.  The | ||||
| constant may be read for code that is expandable like the class template and | ||||
| needs to maintain the same maximum size.  (Example code would be a class that | ||||
| uses this class template as a base class for a member with a flexible set of | ||||
| constructors.)</p> | ||||
|  | ||||
| <h2><a name="usage">Usage</a></h2> | ||||
|  | ||||
| <p>With the starting example, the <code>fdoutbuf</code> sub-object needs | ||||
| @@ -337,6 +348,11 @@ with the exact pointer type used in <code>switcher</code>'s constructor.</p> | ||||
| 		<a href="http://www.informatik.uni-konstanz.de/~kuehl/c++/iostream/">IOStream | ||||
| 		example classes</a>. | ||||
|  | ||||
| 	<dt>Jonathan Turkanis | ||||
| 	<dd>Supplied an implementation of generating the constructor templates that | ||||
| 		can be controlled and automated with macros.  The implementation uses | ||||
| 		the <a href="../preprocessor/index.html">Preprocessor library</a>. | ||||
|  | ||||
| 	<dt><a href="../../people/daryle_walker.html">Daryle Walker</a> | ||||
| 	<dd>Started the library.  Contributed the test file <cite><a | ||||
| 		href="base_from_member_test.cpp">base_from_member_test.cpp</a></cite>. | ||||
| @@ -344,9 +360,9 @@ with the exact pointer type used in <code>switcher</code>'s constructor.</p> | ||||
|  | ||||
| <hr> | ||||
|  | ||||
| <p>Revised: 14 June 2003</p> | ||||
| <p>Revised: 28 August 2004</p> | ||||
|  | ||||
| <p>Copyright 2001, 2003 Daryle Walker.  Use, modification, and distribution | ||||
| <p>Copyright 2001, 2003, 2004 Daryle Walker.  Use, modification, and distribution | ||||
| are subject to the Boost Software License, Version 1.0.  (See accompanying | ||||
| file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or a copy at <<a | ||||
| href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>>.)</p> | ||||
|   | ||||
| @@ -1,8 +1,7 @@ | ||||
| // (C) Copyright David Abrahams 2000. 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. | ||||
| // (C) Copyright David Abrahams 2000. | ||||
| // Distributed under the Boost Software License, Version 1.0. (See | ||||
| // accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
|  | ||||
| #include <vector> | ||||
| #include <string> | ||||
| @@ -15,6 +14,7 @@ | ||||
| #include <algorithm> | ||||
| #include <boost/detail/binary_search.hpp> | ||||
| #include <boost/detail/workaround.hpp> | ||||
| #include <cstddef> | ||||
|  | ||||
| #if defined(__SGI_STL_PORT) ? defined(__SGI_STL_OWN_IOSTREAMS) : (!defined(__GNUC__) || __GNUC__ > 2) | ||||
| # define USE_SSTREAM | ||||
|   | ||||
| @@ -12,7 +12,7 @@ content="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot"> | ||||
| <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" | ||||
| vlink="#800080"> | ||||
|  | ||||
| <h1><img src="../../c++boost.gif" width="276" height="86">Header | ||||
| <h1><img src="../../boost.png" width="276" height="86">Header | ||||
| <<a href="../../boost/detail/call_traits.hpp">boost/call_traits.hpp</a>></h1> | ||||
|  | ||||
| <p>All of the contents of <boost/call_traits.hpp> are | ||||
| @@ -606,7 +606,7 @@ template <bool opt> | ||||
| struct filler | ||||
| { | ||||
|    template <typename I, typename T> | ||||
|    static void do_fill(I first, I last, typename boost::call_traits<T>::param_type val); | ||||
|    static void do_fill(I first, I last, typename boost::call_traits<T>::param_type val) | ||||
|    { | ||||
|       while(first != last) | ||||
|       { | ||||
| @@ -762,3 +762,4 @@ href="http://www.yahoogroups.com/list/boost">www.yahoogroups.com/list/boost</a>. | ||||
| <p> </p> | ||||
| </body> | ||||
| </html> | ||||
|  | ||||
|   | ||||
| @@ -12,14 +12,14 @@ | ||||
| // 03 Oct 2000: | ||||
| //    Enabled extra tests for VC6. | ||||
|  | ||||
| #include <cassert> | ||||
| #include <iostream> | ||||
| #include <iomanip> | ||||
| #include <algorithm> | ||||
| #include <typeinfo> | ||||
| #include <boost/call_traits.hpp> | ||||
|  | ||||
| #include <boost/type_traits/type_traits_test.hpp> | ||||
| #include <libs/type_traits/test/test.hpp> | ||||
| #include <libs/type_traits/test/check_type.hpp> | ||||
|  | ||||
| // a way prevent warnings for unused variables | ||||
| template<class T> inline void unused_variable(const T&) {} | ||||
| @@ -121,9 +121,9 @@ void call_traits_checker<T>::operator()(param_type p) | ||||
|    T t(p); | ||||
|    contained<T> c(t); | ||||
|    cout << "checking contained<" << typeid(T).name() << ">..." << endl; | ||||
|    assert(t == c.value()); | ||||
|    assert(t == c.get()); | ||||
|    assert(t == c.const_get()); | ||||
|    BOOST_CHECK(t == c.value()); | ||||
|    BOOST_CHECK(t == c.get()); | ||||
|    BOOST_CHECK(t == c.const_get()); | ||||
| #ifndef __ICL | ||||
|    //cout << "typeof contained<" << typeid(T).name() << ">::v_ is:           " << typeid(&contained<T>::v_).name() << endl; | ||||
|    cout << "typeof contained<" << typeid(T).name() << ">::value() is:      " << typeid(&contained<T>::value).name() << endl; | ||||
| @@ -145,11 +145,11 @@ struct call_traits_checker<T[N]> | ||||
|       cout << "checking contained<" << typeid(T[N]).name() << ">..." << endl; | ||||
|       unsigned int i = 0; | ||||
|       for(i = 0; i < N; ++i) | ||||
|          assert(t[i] == c.value()[i]); | ||||
|          BOOST_CHECK(t[i] == c.value()[i]); | ||||
|       for(i = 0; i < N; ++i) | ||||
|          assert(t[i] == c.get()[i]); | ||||
|          BOOST_CHECK(t[i] == c.get()[i]); | ||||
|       for(i = 0; i < N; ++i) | ||||
|          assert(t[i] == c.const_get()[i]); | ||||
|          BOOST_CHECK(t[i] == c.const_get()[i]); | ||||
|  | ||||
|       cout << "typeof contained<" << typeid(T[N]).name() << ">::v_ is:         " << typeid(&contained<T[N]>::v_).name() << endl; | ||||
|       cout << "typeof contained<" << typeid(T[N]).name() << ">::value is:      " << typeid(&contained<T[N]>::value).name() << endl; | ||||
| @@ -167,7 +167,7 @@ template <class W, class U> | ||||
| void check_wrap(const W& w, const U& u) | ||||
| { | ||||
|    cout << "checking " << typeid(W).name() << "..." << endl; | ||||
|    assert(w.value() == u); | ||||
|    BOOST_CHECK(w.value() == u); | ||||
| } | ||||
|  | ||||
| // | ||||
| @@ -178,8 +178,8 @@ template <class T, class U, class V> | ||||
| void check_make_pair(T c, U u, V v) | ||||
| { | ||||
|    cout << "checking std::pair<" << typeid(c.first).name() << ", " << typeid(c.second).name() << ">..." << endl; | ||||
|    assert(c.first == u); | ||||
|    assert(c.second == v); | ||||
|    BOOST_CHECK(c.first == u); | ||||
|    BOOST_CHECK(c.second == v); | ||||
|    cout << endl; | ||||
| } | ||||
|  | ||||
| @@ -231,73 +231,67 @@ int main(int argc, char *argv[ ]) | ||||
|    typedef int& r_type; | ||||
|    typedef const r_type cr_type; | ||||
|  | ||||
|    type_test(comparible_UDT, boost::call_traits<comparible_UDT>::value_type) | ||||
|    type_test(comparible_UDT&, boost::call_traits<comparible_UDT>::reference) | ||||
|    type_test(const comparible_UDT&, boost::call_traits<comparible_UDT>::const_reference) | ||||
|    type_test(const comparible_UDT&, boost::call_traits<comparible_UDT>::param_type) | ||||
|    type_test(int, boost::call_traits<int>::value_type) | ||||
|    type_test(int&, boost::call_traits<int>::reference) | ||||
|    type_test(const int&, boost::call_traits<int>::const_reference) | ||||
|    type_test(const int, boost::call_traits<int>::param_type) | ||||
|    type_test(int*, boost::call_traits<int*>::value_type) | ||||
|    type_test(int*&, boost::call_traits<int*>::reference) | ||||
|    type_test(int*const&, boost::call_traits<int*>::const_reference) | ||||
|    type_test(int*const, boost::call_traits<int*>::param_type) | ||||
|    BOOST_CHECK_TYPE(comparible_UDT, boost::call_traits<comparible_UDT>::value_type); | ||||
|    BOOST_CHECK_TYPE(comparible_UDT&, boost::call_traits<comparible_UDT>::reference); | ||||
|    BOOST_CHECK_TYPE(const comparible_UDT&, boost::call_traits<comparible_UDT>::const_reference); | ||||
|    BOOST_CHECK_TYPE(const comparible_UDT&, boost::call_traits<comparible_UDT>::param_type); | ||||
|    BOOST_CHECK_TYPE(int, boost::call_traits<int>::value_type); | ||||
|    BOOST_CHECK_TYPE(int&, boost::call_traits<int>::reference); | ||||
|    BOOST_CHECK_TYPE(const int&, boost::call_traits<int>::const_reference); | ||||
|    BOOST_CHECK_TYPE(const int, boost::call_traits<int>::param_type); | ||||
|    BOOST_CHECK_TYPE(int*, boost::call_traits<int*>::value_type); | ||||
|    BOOST_CHECK_TYPE(int*&, boost::call_traits<int*>::reference); | ||||
|    BOOST_CHECK_TYPE(int*const&, boost::call_traits<int*>::const_reference); | ||||
|    BOOST_CHECK_TYPE(int*const, boost::call_traits<int*>::param_type); | ||||
| #if defined(BOOST_MSVC6_MEMBER_TEMPLATES) | ||||
|    type_test(int&, boost::call_traits<int&>::value_type) | ||||
|    type_test(int&, boost::call_traits<int&>::reference) | ||||
|    type_test(const int&, boost::call_traits<int&>::const_reference) | ||||
|    type_test(int&, boost::call_traits<int&>::param_type) | ||||
|    BOOST_CHECK_TYPE(int&, boost::call_traits<int&>::value_type); | ||||
|    BOOST_CHECK_TYPE(int&, boost::call_traits<int&>::reference); | ||||
|    BOOST_CHECK_TYPE(const int&, boost::call_traits<int&>::const_reference); | ||||
|    BOOST_CHECK_TYPE(int&, boost::call_traits<int&>::param_type); | ||||
| #if !(defined(__GNUC__) && ((__GNUC__ < 3) || (__GNUC__ == 3) && (__GNUC_MINOR__ < 1))) | ||||
|    type_test(int&, boost::call_traits<cr_type>::value_type) | ||||
|    type_test(int&, boost::call_traits<cr_type>::reference) | ||||
|    type_test(const int&, boost::call_traits<cr_type>::const_reference) | ||||
|    type_test(int&, boost::call_traits<cr_type>::param_type) | ||||
|    BOOST_CHECK_TYPE(int&, boost::call_traits<cr_type>::value_type); | ||||
|    BOOST_CHECK_TYPE(int&, boost::call_traits<cr_type>::reference); | ||||
|    BOOST_CHECK_TYPE(const int&, boost::call_traits<cr_type>::const_reference); | ||||
|    BOOST_CHECK_TYPE(int&, boost::call_traits<cr_type>::param_type); | ||||
| #else | ||||
|    std::cout << "Your compiler cannot instantiate call_traits<int&const>, skipping four tests (4 errors)" << std::endl; | ||||
|    failures += 4; | ||||
|    test_count += 4; | ||||
| #endif | ||||
|    type_test(const int&, boost::call_traits<const int&>::value_type) | ||||
|    type_test(const int&, boost::call_traits<const int&>::reference) | ||||
|    type_test(const int&, boost::call_traits<const int&>::const_reference) | ||||
|    type_test(const int&, boost::call_traits<const int&>::param_type) | ||||
|    BOOST_CHECK_TYPE(const int&, boost::call_traits<const int&>::value_type); | ||||
|    BOOST_CHECK_TYPE(const int&, boost::call_traits<const int&>::reference); | ||||
|    BOOST_CHECK_TYPE(const int&, boost::call_traits<const int&>::const_reference); | ||||
|    BOOST_CHECK_TYPE(const int&, boost::call_traits<const int&>::param_type); | ||||
| #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION | ||||
|    type_test(const int*, boost::call_traits<int[3]>::value_type) | ||||
|    type_test(int(&)[3], boost::call_traits<int[3]>::reference) | ||||
|    type_test(const int(&)[3], boost::call_traits<int[3]>::const_reference) | ||||
|    type_test(const int*const, boost::call_traits<int[3]>::param_type) | ||||
|    type_test(const int*, boost::call_traits<const int[3]>::value_type) | ||||
|    type_test(const int(&)[3], boost::call_traits<const int[3]>::reference) | ||||
|    type_test(const int(&)[3], boost::call_traits<const int[3]>::const_reference) | ||||
|    type_test(const int*const, boost::call_traits<const int[3]>::param_type) | ||||
|    BOOST_CHECK_TYPE(const int*, boost::call_traits<int[3]>::value_type); | ||||
|    BOOST_CHECK_TYPE(int(&)[3], boost::call_traits<int[3]>::reference); | ||||
|    BOOST_CHECK_TYPE(const int(&)[3], boost::call_traits<int[3]>::const_reference); | ||||
|    BOOST_CHECK_TYPE(const int*const, boost::call_traits<int[3]>::param_type); | ||||
|    BOOST_CHECK_TYPE(const int*, boost::call_traits<const int[3]>::value_type); | ||||
|    BOOST_CHECK_TYPE(const int(&)[3], boost::call_traits<const int[3]>::reference); | ||||
|    BOOST_CHECK_TYPE(const int(&)[3], boost::call_traits<const int[3]>::const_reference); | ||||
|    BOOST_CHECK_TYPE(const int*const, boost::call_traits<const int[3]>::param_type); | ||||
|    // test with abstract base class: | ||||
|    type_test(test_abc1, boost::call_traits<test_abc1>::value_type) | ||||
|    type_test(test_abc1&, boost::call_traits<test_abc1>::reference) | ||||
|    type_test(const test_abc1&, boost::call_traits<test_abc1>::const_reference) | ||||
|    type_test(const test_abc1&, boost::call_traits<test_abc1>::param_type) | ||||
|    BOOST_CHECK_TYPE(test_abc1, boost::call_traits<test_abc1>::value_type); | ||||
|    BOOST_CHECK_TYPE(test_abc1&, boost::call_traits<test_abc1>::reference); | ||||
|    BOOST_CHECK_TYPE(const test_abc1&, boost::call_traits<test_abc1>::const_reference); | ||||
|    BOOST_CHECK_TYPE(const test_abc1&, boost::call_traits<test_abc1>::param_type); | ||||
| #else | ||||
|    std::cout << "You're compiler does not support partial template specialiation, skipping 8 tests (8 errors)" << std::endl; | ||||
|    failures += 12; | ||||
|    test_count += 12; | ||||
| #endif | ||||
| #else | ||||
|    std::cout << "You're compiler does not support partial template specialiation, skipping 20 tests (20 errors)" << std::endl; | ||||
|    failures += 24; | ||||
|    test_count += 24; | ||||
| #endif | ||||
|    // test with an incomplete type: | ||||
|    type_test(incomplete_type, boost::call_traits<incomplete_type>::value_type) | ||||
|    type_test(incomplete_type&, boost::call_traits<incomplete_type>::reference) | ||||
|    type_test(const incomplete_type&, boost::call_traits<incomplete_type>::const_reference) | ||||
|    type_test(const incomplete_type&, boost::call_traits<incomplete_type>::param_type) | ||||
|    BOOST_CHECK_TYPE(incomplete_type, boost::call_traits<incomplete_type>::value_type); | ||||
|    BOOST_CHECK_TYPE(incomplete_type&, boost::call_traits<incomplete_type>::reference); | ||||
|    BOOST_CHECK_TYPE(const incomplete_type&, boost::call_traits<incomplete_type>::const_reference); | ||||
|    BOOST_CHECK_TYPE(const incomplete_type&, boost::call_traits<incomplete_type>::param_type); | ||||
|  | ||||
|    return check_result(argc, argv); | ||||
|    return 0; | ||||
| } | ||||
|  | ||||
| // | ||||
| // define call_traits tests to check that the assertions in the docs do actually work | ||||
| // this is an instantiate only set of tests: | ||||
| // this is an compile-time only set of tests: | ||||
| // | ||||
| template <typename T, bool isarray = false> | ||||
| struct call_traits_test | ||||
| @@ -409,23 +403,3 @@ template struct call_traits_test<int[2], true>; | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| #if defined(BOOST_MSVC) && _MSC_VER <= 1300 | ||||
| unsigned int expected_failures = 14; | ||||
| #elif defined(__SUNPRO_CC) | ||||
| #if(__SUNPRO_CC <= 0x520) | ||||
| unsigned int expected_failures = 18; | ||||
| #elif(__SUNPRO_CC < 0x530) | ||||
| unsigned int expected_failures = 17; | ||||
| #else | ||||
| unsigned int expected_failures = 6; | ||||
| #endif | ||||
| #elif defined(__BORLANDC__) | ||||
| unsigned int expected_failures = 2; | ||||
| #elif (defined(__GNUC__) && ((__GNUC__ < 3) || (__GNUC__ == 3) && (__GNUC_MINOR__ < 1))) | ||||
| unsigned int expected_failures = 4; | ||||
| #elif defined(__HP_aCC) | ||||
| unsigned int expected_failures = 24; | ||||
| #else | ||||
| unsigned int expected_failures = 0; | ||||
| #endif | ||||
|  | ||||
|   | ||||
| @@ -7,10 +7,9 @@ | ||||
| 	<body bgcolor="white" style="MARGIN-LEFT: 5%; MARGIN-RIGHT: 5%"> | ||||
| 		<table border="0" width="100%"> | ||||
| 			<tr> | ||||
| 				<td width="277"> | ||||
| 					<img src="../../c++boost.gif" alt="c++boost.gif (8819 bytes)" width="277" height="86"> | ||||
| 				<td width="277"><A href="../../index.htm"> <img src="../../boost.png" alt="boost.png (6897 bytes)" width="277" height="86" border="0"></A> | ||||
| 				</td> | ||||
| 				<td align="middle"> | ||||
| 				<td align="center"> | ||||
| 					<h1>checked_delete.hpp</h1> | ||||
| 				</td> | ||||
| 			</tr> | ||||
| @@ -116,9 +115,8 @@ template<class T> struct checked_array_deleter | ||||
| 		</p> | ||||
| 		<p> | ||||
| 			<br> | ||||
| 			<small>Copyright <20> 2002 by Peter Dimov. Permission to copy, use, modify, sell and  | ||||
| 				distribute this document is granted provided this copyright notice appears in  | ||||
| 				all copies. This document is provided "as is" without express or implied  | ||||
| 				warranty, and with no claim as to its suitability for any purpose.</small></p> | ||||
| 			<small>Copyright <20> 2002 by Peter Dimov. Distributed under the Boost Software License, Version  | ||||
| 				1.0. See accompanying file <A href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</A> or  | ||||
| 				copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>.</small></p> | ||||
| 	</body> | ||||
| </html> | ||||
|   | ||||
| @@ -1,7 +1,8 @@ | ||||
| //  Boost checked_delete test program  ---------------------------------------// | ||||
|  | ||||
| //  Copyright Beman Dawes 2001. | ||||
| //  See accompanying license for terms and conditions of use. | ||||
| //  Copyright Beman Dawes 2001.  Distributed under the Boost | ||||
| //  Software License, Version 1.0. (See accompanying file | ||||
| //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||||
|  | ||||
| //  See http://www.boost.org/libs/utility for documentation. | ||||
|  | ||||
|   | ||||
| @@ -1,30 +1,19 @@ | ||||
| <html> | ||||
|  | ||||
| <head> | ||||
| <meta http-equiv="Content-Type" | ||||
| content="text/html; charset=iso-8859-1"> | ||||
| <meta name="Template" | ||||
| content="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot"> | ||||
| <meta name="GENERATOR" content="Microsoft FrontPage Express 2.0"> | ||||
| <title>Header </title> | ||||
| <boost/compressed_pair.hpp> | ||||
| </head> | ||||
|  | ||||
| <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" | ||||
| vlink="#800080"> | ||||
|  | ||||
| <h2><img src="../../c++boost.gif" width="276" height="86">Header | ||||
| <<a href="../../boost/detail/compressed_pair.hpp">boost/compressed_pair.hpp</a>></h2> | ||||
|  | ||||
| <p>All of the contents of <boost/compressed_pair.hpp> are | ||||
| defined inside namespace boost.</p> | ||||
|  | ||||
| <p>The class compressed pair is very similar to std::pair, but if | ||||
| either of the template arguments are empty classes, then the | ||||
| "empty base-class optimisation" is applied to compress | ||||
| the size of the pair.</p> | ||||
|  | ||||
| <pre>template <class T1, class T2> | ||||
|    <head> | ||||
|       <title>Header </title> | ||||
|       <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> | ||||
|       <meta name="Template" content="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot"> | ||||
|       <meta name="GENERATOR" content="Microsoft FrontPage Express 2.0"> | ||||
|       <boostcompressed_pair.hpp> | ||||
|    </head> | ||||
|    <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080"> | ||||
|       <h2><img src="../../boost.png" width="276" height="86">Header <<a href="../../boost/detail/compressed_pair.hpp">boost/compressed_pair.hpp</a>></h2> | ||||
|       <p>All of the contents of <boost/compressed_pair.hpp> are defined inside  | ||||
|          namespace boost.</p> | ||||
|       <p>The class compressed pair is very similar to std::pair, but if either of the  | ||||
|          template arguments are empty classes, then the "empty base-class optimisation"  | ||||
|          is applied to compress the size of the pair.</p> | ||||
|       <pre>template <class T1, class T2> | ||||
| class compressed_pair | ||||
| { | ||||
| public: | ||||
| @@ -52,47 +41,35 @@ public: | ||||
|  | ||||
| 	void swap(compressed_pair& y); | ||||
| };</pre> | ||||
|  | ||||
| <p>The two members of the pair can be accessed using the member | ||||
| functions first() and second(). Note that not all member | ||||
| functions can be instantiated for all template parameter types. | ||||
| In particular compressed_pair can be instantiated for reference | ||||
| and array types, however in these cases the range of constructors | ||||
| that can be used are limited. If types T1 and T2 are the same | ||||
| type, then there is only one version of the single-argument | ||||
| constructor, and this constructor initialises both values in the | ||||
| pair to the passed value.</p> | ||||
|  | ||||
| <p>Note that compressed_pair can not be instantiated if either of | ||||
| the template arguments is a union type, unless there is compiler | ||||
| support for boost::is_union, or if boost::is_union is specialised | ||||
| for the union type.</p> | ||||
|  | ||||
| <p>Finally, a word of caution for Visual C++ 6 users: if either | ||||
| argument is an empty type, then assigning to that member will | ||||
| produce memory corruption, unless the empty type has a "do | ||||
| nothing" assignment operator defined. This is due to a bug | ||||
| in the way VC6 generates implicit assignment operators.</p> | ||||
|  | ||||
| <hr> | ||||
|  | ||||
| <p>Revised 08 May 2001</p> | ||||
|  | ||||
| <p><EFBFBD> Copyright boost.org 2000. Permission to copy, use, modify, | ||||
| sell and distribute this document is granted provided this | ||||
| copyright notice appears in all copies. This document is provided | ||||
| "as is" without express or implied warranty, and with | ||||
| no claim as to its suitability for any purpose.</p> | ||||
|  | ||||
| <p>Based on contributions by Steve Cleary, Beman Dawes, Howard | ||||
| Hinnant and John Maddock.</p> | ||||
|  | ||||
| <p>Maintained by <a href="mailto:john@johnmaddock.co.uk">John | ||||
| Maddock</a>, the latest version of this file can be found at <a | ||||
| href="http://www.boost.org">www.boost.org</a>, and the boost | ||||
| discussion list at <a | ||||
| href="http://www.yahoogroups.com/list/boost">www.yahoogroups.com/list/boost</a>.</p> | ||||
|  | ||||
| <p> </p> | ||||
| </body> | ||||
|       <p>The two members of the pair can be accessed using the member functions first()  | ||||
|          and second(). Note that not all member functions can be instantiated for all  | ||||
|          template parameter types. In particular compressed_pair can be instantiated for  | ||||
|          reference and array types, however in these cases the range of constructors  | ||||
|          that can be used are limited. If types T1 and T2 are the same type, then there  | ||||
|          is only one version of the single-argument constructor, and this constructor  | ||||
|          initialises both values in the pair to the passed value.</p> | ||||
|       <P>Note that if either member is a POD type, then that member is not  | ||||
|          zero-initialized by the compressed_pair default constructor: it's up to you to  | ||||
|          supply an initial value for these types if you want them to have a default  | ||||
|          value.</P> | ||||
|       <p>Note that compressed_pair can not be instantiated if either of the template  | ||||
|          arguments is a union type, unless there is compiler support for  | ||||
|          boost::is_union, or if boost::is_union is specialised for the union type.</p> | ||||
|       <p>Finally, a word of caution for Visual C++ 6 users: if either argument is an  | ||||
|          empty type, then assigning to that member will produce memory corruption,  | ||||
|          unless the empty type has a "do nothing" assignment operator defined. This is  | ||||
|          due to a bug in the way VC6 generates implicit assignment operators.</p> | ||||
|       <hr> | ||||
|       <p>Revised 08 May 2001</p> | ||||
|       <p><EFBFBD> Copyright boost.org 2000. Permission to copy, use, modify, sell and  | ||||
|          distribute this document is granted provided this copyright notice appears in  | ||||
|          all copies. This document is provided "as is" without express or implied  | ||||
|          warranty, and with no claim as to its suitability for any purpose.</p> | ||||
|       <p>Based on contributions by Steve Cleary, Beman Dawes, Howard Hinnant and John  | ||||
|          Maddock.</p> | ||||
|       <p>Maintained by <a href="mailto:john@johnmaddock.co.uk">John Maddock</a>, the  | ||||
|          latest version of this file can be found at <a href="http://www.boost.org">www.boost.org</a>,  | ||||
|          and the boost discussion list at <a href="http://www.yahoogroups.com/list/boost">www.yahoogroups.com/list/boost</a>.</p> | ||||
|       <p> </p> | ||||
|    </body> | ||||
| </html> | ||||
|   | ||||
| @@ -14,29 +14,23 @@ | ||||
| #include <cassert> | ||||
|  | ||||
| #include <boost/compressed_pair.hpp> | ||||
| #include <boost/type_traits/type_traits_test.hpp> | ||||
| #define BOOST_INCLUDE_MAIN | ||||
| #include <boost/test/test_tools.hpp> | ||||
|  | ||||
| using namespace boost; | ||||
|  | ||||
| namespace boost { | ||||
| #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION | ||||
| template <> struct is_empty<empty_UDT> | ||||
| { static const bool value = true; }; | ||||
| template <> struct is_empty<empty_POD_UDT> | ||||
| { static const bool value = true; }; | ||||
| template <> struct is_POD<empty_POD_UDT> | ||||
| { static const bool value = true; }; | ||||
| #else | ||||
| template <> struct is_empty<empty_UDT> | ||||
| { enum{ value = true }; }; | ||||
| template <> struct is_empty<empty_POD_UDT> | ||||
| { enum{ value = true }; }; | ||||
| template <> struct is_POD<empty_POD_UDT> | ||||
| { enum{ value = true }; }; | ||||
| #endif | ||||
| } | ||||
| struct empty_UDT | ||||
| { | ||||
|    ~empty_UDT(){}; | ||||
|    empty_UDT& operator=(const empty_UDT&){ return *this; } | ||||
|    bool operator==(const empty_UDT&)const | ||||
|    { return true; } | ||||
| }; | ||||
| struct empty_POD_UDT | ||||
| { | ||||
|    empty_POD_UDT& operator=(const empty_POD_UDT&){ return *this; } | ||||
|    bool operator==(const empty_POD_UDT&)const | ||||
|    { return true; } | ||||
| }; | ||||
|  | ||||
| struct non_empty1 | ||||
| {  | ||||
| @@ -85,47 +79,47 @@ void compressed_pair_tester<T1, T2>::test(first_param_type p1, second_param_type | ||||
|    // first param construct: | ||||
|    boost::compressed_pair<T1,T2> cp2(p1); | ||||
|    cp2.second() = p2; | ||||
|    BOOST_TEST(cp2.first() == p1); | ||||
|    BOOST_TEST(cp2.second() == p2); | ||||
|    BOOST_CHECK(cp2.first() == p1); | ||||
|    BOOST_CHECK(cp2.second() == p2); | ||||
|    // second param construct: | ||||
|    boost::compressed_pair<T1,T2> cp3(p2); | ||||
|    cp3.first() = p1; | ||||
|    BOOST_TEST(cp3.second() == p2); | ||||
|    BOOST_TEST(cp3.first() == p1); | ||||
|    BOOST_CHECK(cp3.second() == p2); | ||||
|    BOOST_CHECK(cp3.first() == p1); | ||||
|    // both param construct: | ||||
|    boost::compressed_pair<T1,T2> cp4(p1, p2); | ||||
|    BOOST_TEST(cp4.first() == p1); | ||||
|    BOOST_TEST(cp4.second() == p2); | ||||
|    BOOST_CHECK(cp4.first() == p1); | ||||
|    BOOST_CHECK(cp4.second() == p2); | ||||
|    boost::compressed_pair<T1,T2> cp5(p3, p4); | ||||
|    BOOST_TEST(cp5.first() == p3); | ||||
|    BOOST_TEST(cp5.second() == p4); | ||||
|    BOOST_CHECK(cp5.first() == p3); | ||||
|    BOOST_CHECK(cp5.second() == p4); | ||||
|    // check const members: | ||||
|    const boost::compressed_pair<T1,T2>& cpr1 = cp4; | ||||
|    BOOST_TEST(cpr1.first() == p1); | ||||
|    BOOST_TEST(cpr1.second() == p2); | ||||
|    BOOST_CHECK(cpr1.first() == p1); | ||||
|    BOOST_CHECK(cpr1.second() == p2); | ||||
|  | ||||
|    // copy construct: | ||||
|    boost::compressed_pair<T1,T2> cp6(cp4); | ||||
|    BOOST_TEST(cp6.first() == p1); | ||||
|    BOOST_TEST(cp6.second() == p2); | ||||
|    BOOST_CHECK(cp6.first() == p1); | ||||
|    BOOST_CHECK(cp6.second() == p2); | ||||
|    // assignment: | ||||
|    cp1 = cp4; | ||||
|    BOOST_TEST(cp1.first() == p1); | ||||
|    BOOST_TEST(cp1.second() == p2); | ||||
|    BOOST_CHECK(cp1.first() == p1); | ||||
|    BOOST_CHECK(cp1.second() == p2); | ||||
|    cp1 = cp5; | ||||
|    BOOST_TEST(cp1.first() == p3); | ||||
|    BOOST_TEST(cp1.second() == p4); | ||||
|    BOOST_CHECK(cp1.first() == p3); | ||||
|    BOOST_CHECK(cp1.second() == p4); | ||||
|    // swap: | ||||
|    cp4.swap(cp5); | ||||
|    BOOST_TEST(cp4.first() == p3); | ||||
|    BOOST_TEST(cp4.second() == p4); | ||||
|    BOOST_TEST(cp5.first() == p1); | ||||
|    BOOST_TEST(cp5.second() == p2); | ||||
|    BOOST_CHECK(cp4.first() == p3); | ||||
|    BOOST_CHECK(cp4.second() == p4); | ||||
|    BOOST_CHECK(cp5.first() == p1); | ||||
|    BOOST_CHECK(cp5.second() == p2); | ||||
|    swap(cp4,cp5); | ||||
|    BOOST_TEST(cp4.first() == p1); | ||||
|    BOOST_TEST(cp4.second() == p2); | ||||
|    BOOST_TEST(cp5.first() == p3); | ||||
|    BOOST_TEST(cp5.second() == p4); | ||||
|    BOOST_CHECK(cp4.first() == p1); | ||||
|    BOOST_CHECK(cp4.second() == p2); | ||||
|    BOOST_CHECK(cp5.first() == p3); | ||||
|    BOOST_CHECK(cp5.second() == p4); | ||||
| } | ||||
|  | ||||
| // | ||||
| @@ -154,20 +148,20 @@ void compressed_pair_reference_tester<T1, T2>::test(first_param_type p1, second_ | ||||
| #endif | ||||
|    // both param construct: | ||||
|    boost::compressed_pair<T1,T2> cp4(p1, p2); | ||||
|    BOOST_TEST(cp4.first() == p1); | ||||
|    BOOST_TEST(cp4.second() == p2); | ||||
|    BOOST_CHECK(cp4.first() == p1); | ||||
|    BOOST_CHECK(cp4.second() == p2); | ||||
|    boost::compressed_pair<T1,T2> cp5(p3, p4); | ||||
|    BOOST_TEST(cp5.first() == p3); | ||||
|    BOOST_TEST(cp5.second() == p4); | ||||
|    BOOST_CHECK(cp5.first() == p3); | ||||
|    BOOST_CHECK(cp5.second() == p4); | ||||
|    // check const members: | ||||
|    const boost::compressed_pair<T1,T2>& cpr1 = cp4; | ||||
|    BOOST_TEST(cpr1.first() == p1); | ||||
|    BOOST_TEST(cpr1.second() == p2); | ||||
|    BOOST_CHECK(cpr1.first() == p1); | ||||
|    BOOST_CHECK(cpr1.second() == p2); | ||||
|  | ||||
|    // copy construct: | ||||
|    boost::compressed_pair<T1,T2> cp6(cp4); | ||||
|    BOOST_TEST(cp6.first() == p1); | ||||
|    BOOST_TEST(cp6.second() == p2); | ||||
|    BOOST_CHECK(cp6.first() == p1); | ||||
|    BOOST_CHECK(cp6.second() == p2); | ||||
|    // assignment: | ||||
|    // VC6 bug: | ||||
|    // When second() is an empty class, VC6 performs the | ||||
| @@ -180,8 +174,8 @@ void compressed_pair_reference_tester<T1, T2>::test(first_param_type p1, second_ | ||||
|    // settings - some generate the problem others do not. | ||||
|    cp4.first() = p3; | ||||
|    cp4.second() = p4; | ||||
|    BOOST_TEST(cp4.first() == p3); | ||||
|    BOOST_TEST(cp4.second() == p4); | ||||
|    BOOST_CHECK(cp4.first() == p3); | ||||
|    BOOST_CHECK(cp4.second() == p4); | ||||
| } | ||||
| // | ||||
| // supplimentary tests for case where first arg only is a reference type: | ||||
| @@ -205,8 +199,8 @@ void compressed_pair_reference1_tester<T1, T2>::test(first_param_type p1, second | ||||
|    // first param construct: | ||||
|    boost::compressed_pair<T1,T2> cp2(p1); | ||||
|    cp2.second() = p2; | ||||
|    BOOST_TEST(cp2.first() == p1); | ||||
|    BOOST_TEST(cp2.second() == p2); | ||||
|    BOOST_CHECK(cp2.first() == p1); | ||||
|    BOOST_CHECK(cp2.second() == p2); | ||||
| #endif | ||||
| } | ||||
| // | ||||
| @@ -231,8 +225,8 @@ void compressed_pair_reference2_tester<T1, T2>::test(first_param_type p1, second | ||||
|    // second param construct: | ||||
|    boost::compressed_pair<T1,T2> cp3(p2); | ||||
|    cp3.first() = p1; | ||||
|    BOOST_TEST(cp3.second() == p2); | ||||
|    BOOST_TEST(cp3.first() == p1); | ||||
|    BOOST_CHECK(cp3.second() == p2); | ||||
|    BOOST_CHECK(cp3.first() == p1); | ||||
| #endif | ||||
| } | ||||
|  | ||||
| @@ -259,14 +253,14 @@ void compressed_pair_array1_tester<T1, T2>::test(first_param_type p1, second_par | ||||
|    // second param construct: | ||||
|    boost::compressed_pair<T1,T2> cp3(p2); | ||||
|    cp3.first()[0] = p1[0]; | ||||
|    BOOST_TEST(cp3.second() == p2); | ||||
|    BOOST_TEST(cp3.first()[0] == p1[0]); | ||||
|    BOOST_CHECK(cp3.second() == p2); | ||||
|    BOOST_CHECK(cp3.first()[0] == p1[0]); | ||||
|    // check const members: | ||||
|    const boost::compressed_pair<T1,T2>& cpr1 = cp3; | ||||
|    BOOST_TEST(cpr1.first()[0] == p1[0]); | ||||
|    BOOST_TEST(cpr1.second() == p2); | ||||
|    BOOST_CHECK(cpr1.first()[0] == p1[0]); | ||||
|    BOOST_CHECK(cpr1.second() == p2); | ||||
|  | ||||
|    BOOST_TEST(sizeof(T1) == sizeof(cp1.first())); | ||||
|    BOOST_CHECK(sizeof(T1) == sizeof(cp1.first())); | ||||
| } | ||||
|  | ||||
| template <class T1, class T2> | ||||
| @@ -289,14 +283,14 @@ void compressed_pair_array2_tester<T1, T2>::test(first_param_type p1, second_par | ||||
|    // first param construct: | ||||
|    boost::compressed_pair<T1,T2> cp2(p1); | ||||
|    cp2.second()[0] = p2[0]; | ||||
|    BOOST_TEST(cp2.first() == p1); | ||||
|    BOOST_TEST(cp2.second()[0] == p2[0]); | ||||
|    BOOST_CHECK(cp2.first() == p1); | ||||
|    BOOST_CHECK(cp2.second()[0] == p2[0]); | ||||
|    // check const members: | ||||
|    const boost::compressed_pair<T1,T2>& cpr1 = cp2; | ||||
|    BOOST_TEST(cpr1.first() == p1); | ||||
|    BOOST_TEST(cpr1.second()[0] == p2[0]); | ||||
|    BOOST_CHECK(cpr1.first() == p1); | ||||
|    BOOST_CHECK(cpr1.second()[0] == p2[0]); | ||||
|  | ||||
|    BOOST_TEST(sizeof(T2) == sizeof(cp1.second())); | ||||
|    BOOST_CHECK(sizeof(T2) == sizeof(cp1.second())); | ||||
| } | ||||
|  | ||||
| template <class T1, class T2> | ||||
| @@ -318,15 +312,15 @@ void compressed_pair_array_tester<T1, T2>::test(first_param_type p1, second_para | ||||
|    boost::compressed_pair<T1,T2> cp1; | ||||
|    cp1.first()[0] = p1[0]; | ||||
|    cp1.second()[0] = p2[0]; | ||||
|    BOOST_TEST(cp1.first()[0] == p1[0]); | ||||
|    BOOST_TEST(cp1.second()[0] == p2[0]); | ||||
|    BOOST_CHECK(cp1.first()[0] == p1[0]); | ||||
|    BOOST_CHECK(cp1.second()[0] == p2[0]); | ||||
|    // check const members: | ||||
|    const boost::compressed_pair<T1,T2>& cpr1 = cp1; | ||||
|    BOOST_TEST(cpr1.first()[0] == p1[0]); | ||||
|    BOOST_TEST(cpr1.second()[0] == p2[0]); | ||||
|    BOOST_CHECK(cpr1.first()[0] == p1[0]); | ||||
|    BOOST_CHECK(cpr1.second()[0] == p2[0]); | ||||
|  | ||||
|    BOOST_TEST(sizeof(T1) == sizeof(cp1.first())); | ||||
|    BOOST_TEST(sizeof(T2) == sizeof(cp1.second())); | ||||
|    BOOST_CHECK(sizeof(T1) == sizeof(cp1.first())); | ||||
|    BOOST_CHECK(sizeof(T2) == sizeof(cp1.second())); | ||||
| } | ||||
|  | ||||
| int test_main(int, char *[]) | ||||
|   | ||||
| @@ -1,60 +0,0 @@ | ||||
| // (C) Copyright Jeremy Siek 2000. 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 <boost/config.hpp> | ||||
| #include <algorithm> | ||||
| #include <iostream> | ||||
| #include <iterator> | ||||
| #include <vector> | ||||
| #include <boost/iterator/counting_iterator.hpp> | ||||
| #include <boost/iterator/indirect_iterator.hpp> | ||||
|  | ||||
| int main(int, char*[]) | ||||
| { | ||||
|   // Example of using counting_iterator_generator | ||||
|   std::cout << "counting from 0 to 4:" << std::endl; | ||||
|   boost::counting_iterator<int> first(0), last(4); | ||||
|   std::copy(first, last, std::ostream_iterator<int>(std::cout, " ")); | ||||
|   std::cout << std::endl; | ||||
|  | ||||
|   // Example of using make_counting_iterator() | ||||
|   std::cout << "counting from -5 to 4:" << std::endl; | ||||
|   std::copy(boost::make_counting_iterator(-5), | ||||
|             boost::make_counting_iterator(5), | ||||
|             std::ostream_iterator<int>(std::cout, " ")); | ||||
|   std::cout << std::endl; | ||||
|  | ||||
|   // Example of using counting iterator to create an array of pointers. | ||||
| #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) | ||||
|   const | ||||
| #endif  | ||||
|       int N = 7; | ||||
|   std::vector<int> numbers; | ||||
|   // Fill "numbers" array with [0,N) | ||||
|   std::copy( | ||||
|       boost::make_counting_iterator(0) | ||||
|       , boost::make_counting_iterator(N) | ||||
|       , std::back_inserter(numbers)); | ||||
|  | ||||
|   std::vector<std::vector<int>::iterator> pointers; | ||||
|  | ||||
|   // Use counting iterator to fill in the array of pointers. | ||||
|   // causes an ICE with MSVC6 | ||||
|   std::copy(boost::make_counting_iterator(numbers.begin()), | ||||
|             boost::make_counting_iterator(numbers.end()), | ||||
|             std::back_inserter(pointers)); | ||||
|  | ||||
|   // Use indirect iterator to print out numbers by accessing | ||||
|   // them through the array of pointers. | ||||
|   std::cout << "indirectly printing out the numbers from 0 to "  | ||||
|             << N << std::endl; | ||||
|   std::copy(boost::make_indirect_iterator(pointers.begin()), | ||||
|             boost::make_indirect_iterator(pointers.end()), | ||||
|             std::ostream_iterator<int>(std::cout, " ")); | ||||
|   std::cout << std::endl; | ||||
|    | ||||
|   return 0; | ||||
| } | ||||
| @@ -7,10 +7,9 @@ | ||||
| 	<body bgcolor="white" style="MARGIN-LEFT: 5%; MARGIN-RIGHT: 5%"> | ||||
| 		<table border="0" width="100%"> | ||||
| 			<tr> | ||||
| 				<td width="277"> | ||||
| 					<img src="../../c++boost.gif" alt="c++boost.gif (8819 bytes)" width="277" height="86"> | ||||
| 				<td width="277"><A href="../../index.htm"> <img src="../../boost.png" alt="boost.png (6897 bytes)" width="277" height="86" border="0"></A> | ||||
| 				</td> | ||||
| 				<td align="middle"> | ||||
| 				<td align="center"> | ||||
| 					<h1>current_function.hpp</h1> | ||||
| 				</td> | ||||
| 			</tr> | ||||
| @@ -30,9 +29,8 @@ | ||||
| 			function. On such compilers, the string literal has an unspecified value.</p> | ||||
| 		<p> | ||||
| 			<br> | ||||
| 			<small>Copyright <20> 2002 by Peter Dimov. Permission to copy, use, modify, sell and  | ||||
| 				distribute this document is granted provided this copyright notice appears in  | ||||
| 				all copies. This document is provided "as is" without express or implied  | ||||
| 				warranty, and with no claim as to its suitability for any purpose.</small></p> | ||||
| 			<small>Copyright <20> 2002 by Peter Dimov. Distributed under the Boost Software License, Version  | ||||
| 				1.0. See accompanying file <A href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</A> or  | ||||
| 				copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>.</small></p> | ||||
| 	</body> | ||||
| </html> | ||||
|   | ||||
| @@ -12,18 +12,22 @@ | ||||
| // | ||||
| //  Copyright (c) 2002 Peter Dimov and Multi Media Ltd. | ||||
| // | ||||
| //  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. | ||||
| // Distributed under the Boost Software License, Version 1.0. (See | ||||
| // accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
|  | ||||
| #include <boost/current_function.hpp> | ||||
| #include <boost/config.hpp> | ||||
| #include <cstdio> | ||||
|  | ||||
| void message(char const * file, long line, char const * func, char const * msg) | ||||
| { | ||||
|     std::printf("%s(%ld): %s in function '%s'\n", file, line, msg, func); | ||||
| #if !defined(BOOST_NO_STDC_NAMESPACE) | ||||
|     using std::printf; | ||||
| #endif | ||||
|  | ||||
|     printf("%s(%ld): %s in function '%s'\n", file, line, msg, func); | ||||
| } | ||||
|  | ||||
| #define MESSAGE(msg) message(__FILE__, __LINE__, BOOST_CURRENT_FUNCTION, msg) | ||||
| @@ -31,4 +35,6 @@ void message(char const * file, long line, char const * func, char const * msg) | ||||
| int main() | ||||
| { | ||||
|     MESSAGE("assertion failed"); | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
|   | ||||
| @@ -17,7 +17,7 @@ | ||||
|  | ||||
|  | ||||
| <h1> | ||||
| <img border="0" src="../../c++boost.gif" align="center" width="277" height="86">enable_if</h1> | ||||
| <img border="0" src="../../boost.png" align="center" width="277" height="86">enable_if</h1> | ||||
| <BR> | ||||
| <BR> | ||||
| Copyright 2003 Jaakko Järvi, Jeremiah Willcock, Andrew Lumsdaine.<BR> | ||||
| @@ -128,7 +128,7 @@ When valid, <TT>enable_if_c<B, T>::type</TT> equals <TT>T</TT>. | ||||
| The <TT>enable_if_c</TT> template can thus be used for controlling when functions are considered for | ||||
| overload resolution and when they are not.  | ||||
| For example, the following function is defined for all arithmetic types (according to the | ||||
| classification of the <A HREF="http://www.boost.org/libs/type_traits">Boost type_traits library</A>): | ||||
| classification of the <A HREF="../type_traits/index.html">Boost type_traits library</A>): | ||||
| <PRE>template <class T> | ||||
| typename enable_if_c<boost::is_arithmetic<T>::value, T>::type  | ||||
| foo(T t) { return t; } | ||||
| @@ -303,7 +303,7 @@ foo(T t); | ||||
| <UL><LI> | ||||
| Use an extra dummy parameter which disambiguates the functions. Use a default value for | ||||
| it to hide the parameter from the caller. For example: | ||||
| <PRE>template <class T> struct dummy { dummy(int) {} }; | ||||
| <PRE>template <int> struct dummy { dummy(int) {} }; | ||||
|  | ||||
| template <class T> | ||||
| typename enable_if<boost::is_arithmetic<T>, T>::type  | ||||
|   | ||||
							
								
								
									
										23
									
								
								enable_if/test/Jamfile.v2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								enable_if/test/Jamfile.v2
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| # Copyright David Abrahams 2003. | ||||
| # Distributed under the Boost Software License, Version 1.0.  | ||||
| # (See accompanying file LICENSE_1_0.txt or copy at  | ||||
| # http://www.boost.org/LICENSE_1_0.txt) | ||||
|  | ||||
| # For more information, see http://www.boost.org/ | ||||
|  | ||||
| project | ||||
|     : requirements <library>/boost/test//boost_test_exec_monitor | ||||
|     ; | ||||
|  | ||||
| test-suite utility/enable_if | ||||
|         : | ||||
|         [ run constructors.cpp ] | ||||
|         [ run dummy_arg_disambiguation.cpp ] | ||||
|         [ run lazy.cpp ] | ||||
|         [ run lazy_test.cpp ] | ||||
|         [ run member_templates.cpp ] | ||||
|         [ run namespace_disambiguation.cpp ] | ||||
|         [ run no_disambiguation.cpp ] | ||||
|         [ run partial_specializations.cpp ] | ||||
|     ; | ||||
|  | ||||
| @@ -61,7 +61,7 @@ mult(const T& x, const U& y) {return x * y;} | ||||
| #if 1 | ||||
| template <class T, class U> | ||||
| typename lazy_enable_if_c< | ||||
|   is_int<T>::value && is_int<U>::value, | ||||
|   is_int<T>::value & is_int<U>::value, | ||||
|   mult_traits<T, U>  | ||||
| >::type | ||||
| mult(const T& x, const U& y) {return x * y;} | ||||
| @@ -1,62 +0,0 @@ | ||||
| // Example of using the filter iterator adaptor from | ||||
| // boost/iterator_adaptors.hpp. | ||||
|  | ||||
| //  (C) Copyright Jeremy Siek 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 <boost/config.hpp> | ||||
| #include <algorithm> | ||||
| #include <functional> | ||||
| #include <iostream> | ||||
| #include <boost/iterator/filter_iterator.hpp> | ||||
|  | ||||
| struct is_positive_number { | ||||
|   bool operator()(int x) { return 0 < x; } | ||||
| }; | ||||
|  | ||||
| int main() | ||||
| { | ||||
|   int numbers_[] = { 0, -1, 4, -3, 5, 8, -2 }; | ||||
|   const int N = sizeof(numbers_)/sizeof(int); | ||||
|    | ||||
|   typedef int* base_iterator; | ||||
|   base_iterator numbers(numbers_); | ||||
|    | ||||
|   // Example using make_filter_iterator() | ||||
|   std::copy(boost::make_filter_iterator<is_positive_number>(numbers, numbers + N), | ||||
|             boost::make_filter_iterator<is_positive_number>(numbers + N, numbers + N), | ||||
|             std::ostream_iterator<int>(std::cout, " ")); | ||||
|   std::cout << std::endl; | ||||
|  | ||||
|   // Example using filter_iterator | ||||
|   typedef boost::filter_iterator<is_positive_number, base_iterator> | ||||
|     FilterIter; | ||||
|    | ||||
|   is_positive_number predicate; | ||||
|   FilterIter filter_iter_first(predicate, numbers, numbers + N); | ||||
|   FilterIter filter_iter_last(predicate, numbers + N, numbers + N); | ||||
|  | ||||
|   std::copy(filter_iter_first, filter_iter_last, std::ostream_iterator<int>(std::cout, " ")); | ||||
|   std::cout << std::endl; | ||||
|  | ||||
|   // Another example using make_filter_iterator() | ||||
|   std::copy( | ||||
|       boost::make_filter_iterator( | ||||
|           std::bind2nd(std::greater<int>(), -2) | ||||
|         , numbers, numbers + N) | ||||
|              | ||||
|     , boost::make_filter_iterator( | ||||
|           std::bind2nd(std::greater<int>(), -2) | ||||
|         , numbers + N, numbers + N) | ||||
|        | ||||
|     , std::ostream_iterator<int>(std::cout, " ") | ||||
|   ); | ||||
|    | ||||
|   std::cout << std::endl; | ||||
|    | ||||
|    | ||||
|   return 0; | ||||
| } | ||||
| @@ -1,47 +0,0 @@ | ||||
| // (C) Copyright Jeremy Siek 2001. 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. | ||||
|  | ||||
| // Revision History: | ||||
|  | ||||
| // 27 Feb 2001   Jeremy Siek | ||||
| //      Initial checkin. | ||||
|  | ||||
| #include <iostream> | ||||
| #include <string> | ||||
| #include <vector> | ||||
|  | ||||
| #include <boost/function_output_iterator.hpp> | ||||
|  | ||||
| struct string_appender | ||||
| { | ||||
|     string_appender(std::string& s) | ||||
|         : m_str(&s) | ||||
|     {} | ||||
|      | ||||
|     void operator()(const std::string& x) const | ||||
|     { | ||||
|         *m_str += x; | ||||
|     } | ||||
|  | ||||
|     std::string* m_str; | ||||
| }; | ||||
|  | ||||
| int main(int, char*[]) | ||||
| { | ||||
|   std::vector<std::string> x; | ||||
|   x.push_back("hello"); | ||||
|   x.push_back(" "); | ||||
|   x.push_back("world"); | ||||
|   x.push_back("!"); | ||||
|  | ||||
|   std::string s = ""; | ||||
|   std::copy(x.begin(), x.end(),  | ||||
|             boost::make_function_output_iterator(string_appender(s))); | ||||
|    | ||||
|   std::cout << s << std::endl; | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
| @@ -1,33 +1,37 @@ | ||||
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> | ||||
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | ||||
|  | ||||
| <html> | ||||
| <head> | ||||
| <title>Generator Iterator Adaptor Documentation</title> | ||||
|   <meta http-equiv="Content-Language" content="en-us"> | ||||
|   <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> | ||||
|  | ||||
|   <title>Generator Iterator Adaptor Documentation</title> | ||||
| </head> | ||||
|  | ||||
| <body bgcolor="#FFFFFF" text="#000000"> | ||||
|          | ||||
| <img src="../../c++boost.gif" alt="c++boost.gif (8819 bytes)" align="center" width="277" height="86">  | ||||
|   <img src="../../boost.png" alt="boost.png (6897 bytes)" align="middle" | ||||
|   width="277" height="86"> | ||||
|  | ||||
| <h1>Generator Iterator Adaptor</h1> | ||||
| Defined in header <a href="../../boost/generator_iterator.hpp">boost/generator_iterator.hpp</a>  | ||||
| <p> | ||||
| The generator iterator adaptor makes it easier to create custom input | ||||
| iterators from 0-ary functions and function objects.  The adaptor | ||||
| takes a | ||||
| <a href="http://www.sgi.com/tech/stl/Generator.html">Generator</a> | ||||
| and creates a model of | ||||
| <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>. | ||||
| Each increment retrieves an item from the generator and makes it | ||||
| available to be retrieved by dereferencing.  The motivation for this | ||||
| iterator is that some concepts can be more naturally expressed as a | ||||
| generator, while most STL algorithms expect an iterator.  An example | ||||
| is the <a href="../random/index.html">Random Number</a> library. | ||||
|   <h1>Generator Iterator Adaptor</h1> | ||||
|  | ||||
| <h2>Synopsis</h2> | ||||
|   <p>Defined in header <a href= | ||||
|   "../../boost/generator_iterator.hpp">boost/generator_iterator.hpp</a></p> | ||||
|  | ||||
| <blockquote> | ||||
| <pre> | ||||
|   <p>The generator iterator adaptor makes it easier to create custom input | ||||
|   iterators from 0-ary functions and function objects. The adaptor takes a | ||||
|   <a href="http://www.sgi.com/tech/stl/Generator.html">Generator</a> and | ||||
|   creates a model of <a href= | ||||
|   "http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>. Each | ||||
|   increment retrieves an item from the generator and makes it available to be | ||||
|   retrieved by dereferencing. The motivation for this iterator is that some | ||||
|   concepts can be more naturally expressed as a generator, while most STL | ||||
|   algorithms expect an iterator. An example is the <a href= | ||||
|   "../random/index.html">Random Number</a> library.</p> | ||||
|  | ||||
|   <h2>Synopsis</h2> | ||||
|  | ||||
|   <blockquote> | ||||
|     <pre> | ||||
| namespace boost { | ||||
|   template <class Generator> | ||||
|   class generator_iterator_policies; | ||||
| @@ -40,87 +44,85 @@ namespace boost { | ||||
|   make_generator_iterator(Generator & gen); | ||||
| } | ||||
| </pre> | ||||
| </blockquote> | ||||
|   </blockquote> | ||||
|   <hr> | ||||
|  | ||||
| <hr> | ||||
|   <h2>The Generator Iterator Generator Class</h2> | ||||
|  | ||||
| <h2>The Generator Iterator Generator Class</h2> | ||||
|  | ||||
| The class generator_iterator_generator is a helper class whose purpose | ||||
| is to construct a generator iterator type. The template parameter for | ||||
| this class is the Generator function object type that is being | ||||
| wrapped.  The generator iterator adaptor only holds a reference (or | ||||
| pointer) to the function object, therefore the function object must | ||||
| outlive the generator iterator adaptor constructed from it. | ||||
|  | ||||
| <pre> | ||||
| template <class Generator> | ||||
|   <p>The class generator_iterator_generator is a helper class whose purpose | ||||
|   is to construct a generator iterator type. The template parameter for this | ||||
|   class is the Generator function object type that is being wrapped. The | ||||
|   generator iterator adaptor only holds a reference (or pointer) to the | ||||
|   function object, therefore the function object must outlive the generator | ||||
|   iterator adaptor constructed from it.</p> | ||||
|   <pre> | ||||
| template <class Generator> | ||||
| class generator_iterator_generator | ||||
| { | ||||
| public: | ||||
|   typedef <a href="iterator_adaptors.htm#iterator_adaptor">iterator_adaptor</a><...> type; // the resulting generator iterator type  | ||||
|   typedef <i>unspecified</i> type; // the resulting generator iterator type  | ||||
| } | ||||
| </pre> | ||||
|  | ||||
|   <h3>Template Parameters</h3> | ||||
|  | ||||
| <h3>Template Parameters</h3> | ||||
|   <table border summary=""> | ||||
|     <tr> | ||||
|       <th>Parameter</th> | ||||
|  | ||||
| <table border> | ||||
| <tr> | ||||
| <th>Parameter</th> | ||||
| <th>Description</th> | ||||
| </tr> | ||||
|       <th>Description</th> | ||||
|     </tr> | ||||
|  | ||||
| <tr> | ||||
| <td><tt><a href="http://www.sgi.com/tech/stl/Generator.html">Generator</a></tt>  | ||||
| <td>The generator (0-ary function object) type being | ||||
| wrapped.  The return type of the function must be defined as | ||||
| <tt>Generator::result_type</tt>.  The function object must be a model | ||||
| of | ||||
| <a href="http://www.sgi.com/tech/stl/Generator.html">Generator</a>. | ||||
| </td> | ||||
| </table> | ||||
|     <tr> | ||||
|       <td><tt><a href= | ||||
|       "http://www.sgi.com/tech/stl/Generator.html">Generator</a></tt></td> | ||||
|  | ||||
| <h3>Concept Model</h3> | ||||
| The generator iterator class is a model of | ||||
| <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>. | ||||
|       <td>The generator (0-ary function object) type being wrapped. The | ||||
|       return type of the function must be defined as | ||||
|       <tt>Generator::result_type</tt>. The function object must be a model of | ||||
|       <a href= | ||||
|       "http://www.sgi.com/tech/stl/Generator.html">Generator</a>.</td> | ||||
|     </tr> | ||||
|   </table> | ||||
|  | ||||
| <h3>Members</h3> | ||||
| The generator iterator implements the member functions | ||||
| and operators required of the | ||||
| <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> | ||||
| concept. | ||||
|   <h3>Concept Model</h3> | ||||
|  | ||||
| <br> | ||||
|   <p>The generator iterator class is a model of <a href= | ||||
|   "http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a>.</p> | ||||
|  | ||||
| <hr> | ||||
| <h2><a name="make_generator_iterator">The Generator Iterator Object Generator</a></h2> | ||||
|   <h3>Members</h3> | ||||
|  | ||||
| The <tt>make_generator_iterator()</tt> function provides a | ||||
| convenient way to create generator iterator objects. The function | ||||
| saves the user the trouble of explicitly writing out the iterator | ||||
| types. | ||||
|   <p>The generator iterator implements the member functions and operators | ||||
|   required of the <a href= | ||||
|   "http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> | ||||
|   concept.<br></p> | ||||
|   <hr> | ||||
|  | ||||
| <blockquote> | ||||
| <pre> | ||||
|   <h2><a name="make_generator_iterator" id="make_generator_iterator">The | ||||
|   Generator Iterator Object Generator</a></h2> | ||||
|  | ||||
|   <p>The <tt>make_generator_iterator()</tt> function provides a convenient | ||||
|   way to create generator iterator objects. The function saves the user the | ||||
|   trouble of explicitly writing out the iterator types.</p> | ||||
|  | ||||
|   <blockquote> | ||||
|     <pre> | ||||
| template <class Generator> | ||||
| typename generator_iterator_generator<Generator>::type | ||||
| make_generator_iterator(Generator & gen); | ||||
| </pre> | ||||
| </blockquote> | ||||
|   </blockquote> | ||||
|   <hr> | ||||
|  | ||||
| <hr> | ||||
|   <h3>Example</h3> | ||||
|  | ||||
|   <p>The following program shows how <code>generator_iterator</code> | ||||
|   transforms a generator into an input iterator.</p> | ||||
|  | ||||
| <h3>Example</h3> | ||||
|  | ||||
| The following program shows how <code>generator_iterator</code> | ||||
| transforms a generator into an input iterator. | ||||
|  | ||||
| <blockquote> | ||||
| <pre> | ||||
| #include <iostream> | ||||
| #include <boost/generator_iterator.hpp> | ||||
|   <blockquote> | ||||
|     <pre> | ||||
| #include <iostream> | ||||
| #include <boost/generator_iterator.hpp> | ||||
|  | ||||
| class my_generator | ||||
| { | ||||
| @@ -140,11 +142,22 @@ int main() | ||||
|     std::cout << *it << std::endl; | ||||
| } | ||||
| </pre> | ||||
| </blockquote> | ||||
|   </blockquote> | ||||
|   <hr> | ||||
|  | ||||
| <hr> | ||||
|   <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src= | ||||
|   "http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" | ||||
|   height="31" width="88"></a></p> | ||||
|  | ||||
| Written by Jens Maurer. | ||||
|   <p>Revised  | ||||
|   <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->05 December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38516" --></p> | ||||
|  | ||||
|   <p><i>Copyright © 2001 <a href= | ||||
|   "../../people/jens_maurer.htm">Jens Maurer</a></i></p> | ||||
|  | ||||
|   <p><i>Distributed under the Boost Software License, Version 1.0. (See | ||||
|   accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or | ||||
|   copy at <a href= | ||||
|   "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p> | ||||
| </body> | ||||
| </html> | ||||
|   | ||||
| @@ -1,366 +0,0 @@ | ||||
| // (C) Copyright David Abrahams 2001. 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 for most recent version including documentation. | ||||
| // | ||||
| // Revision History | ||||
| // 11 Feb 2001  Compile with Borland, re-enable failing tests (David Abrahams) | ||||
| // 29 Jan 2001  Initial revision (David Abrahams) | ||||
|  | ||||
| #include <boost/half_open_range.hpp> | ||||
| #include <boost/utility.hpp> | ||||
| #include <iterator> | ||||
| #include <stdlib.h> | ||||
| #include <vector> | ||||
| #include <list> | ||||
| #include <cassert> | ||||
| #include <stdexcept> | ||||
| #ifndef BOOST_NO_LIMITS | ||||
| # include <limits> | ||||
| #endif | ||||
| #ifndef BOOST_NO_SLIST | ||||
| # include <slist> | ||||
| #endif | ||||
|  | ||||
| inline unsigned unsigned_random(unsigned max) | ||||
| { | ||||
|     return (max > 0) ? (unsigned)rand() % max : 0; | ||||
| } | ||||
|  | ||||
| // Special tests for ranges supporting random access | ||||
| template <class T> | ||||
| void category_test_1( | ||||
|     const boost::half_open_range<T>& r, std::random_access_iterator_tag) | ||||
| { | ||||
|     typedef boost::half_open_range<T> range; | ||||
|     typedef typename range::size_type size_type; | ||||
|     size_type size = r.size(); | ||||
|  | ||||
|     // pick a random offset | ||||
|     size_type offset = unsigned_random(size); | ||||
|  | ||||
|     typename range::value_type x = *(r.begin() + offset); | ||||
|     // test contains(value_type) | ||||
|     assert(r.contains(r.start()) == !r.empty()); | ||||
|     assert(!r.contains(r.finish())); | ||||
|     assert(r.contains(x) == (offset != size)); | ||||
|  | ||||
|     range::const_iterator p = r.find(x); | ||||
|     assert((p == r.end()) == (x == r.finish())); | ||||
|     assert(r.find(r.finish()) == r.end()); | ||||
|  | ||||
|     if (offset != size) | ||||
|     { | ||||
|         assert(x == r[offset]); | ||||
|         assert(x == r.at(offset)); | ||||
|     } | ||||
|  | ||||
|     bool caught_out_of_range = false; | ||||
|     try { | ||||
|         bool never_initialized = x == r.at(size); | ||||
|         (void)never_initialized; | ||||
|     } | ||||
|     catch(std::out_of_range&) | ||||
|     { | ||||
|         caught_out_of_range = true; | ||||
|     } | ||||
|     catch(...) | ||||
|     { | ||||
|     } | ||||
|     assert(caught_out_of_range); | ||||
| } | ||||
|  | ||||
| // Those tests must be skipped for other ranges | ||||
| template <class T> | ||||
| void category_test_1( | ||||
|     const boost::half_open_range<T>&, std::forward_iterator_tag) | ||||
| { | ||||
| } | ||||
|  | ||||
| unsigned indices[][2] = { {0,0},{0,1},{0,2},{0,3}, | ||||
|                                 {1,1},{1,2},{1,3}, | ||||
|                                       {2,2},{2,3}, | ||||
|                                             {3,3}}; | ||||
|  | ||||
| template <class Range> | ||||
| void category_test_2( | ||||
|     const std::vector<Range>& ranges, unsigned i, unsigned j, std::random_access_iterator_tag) | ||||
| { | ||||
|     typedef Range range; | ||||
|     const range& ri = ranges[i]; | ||||
|     const range& rj = ranges[j]; | ||||
|  | ||||
|     if (indices[i][0] <= indices[j][0] && indices[i][1] >= indices[j][1]) | ||||
|         assert(ri.contains(rj)); | ||||
|  | ||||
|     if (ri.contains(rj)) | ||||
|         assert((ri & rj) == rj); | ||||
|     assert(boost::intersects(ri, rj) == !(ri & rj).empty()); | ||||
|  | ||||
|     range t1(ri); | ||||
|     t1 &= rj; | ||||
|     assert(t1 == range(indices[i][0] > indices[j][0] ? ri.start() : rj.start(), | ||||
|                        indices[i][1] < indices[j][1] ? ri.finish() : rj.finish())); | ||||
|     assert(t1 == (ri & rj)); | ||||
|      | ||||
|     range t2(ri); | ||||
|     t2 |= rj; | ||||
|      | ||||
|     if (ri.empty()) | ||||
|         assert(t2 == rj); | ||||
|     else if (rj.empty()) | ||||
|         assert(t2 == ri); | ||||
|     else | ||||
|         assert(t2 == range(indices[i][0] < indices[j][0] ? ri.start() : rj.start(), | ||||
|                            indices[i][1] > indices[j][1] ? ri.finish() : rj.finish())); | ||||
|     assert(t2 == (ri | rj)); | ||||
|     if (i == j) | ||||
|         assert(ri == rj); | ||||
|      | ||||
|     if (ri.empty() || rj.empty()) | ||||
|         assert((ri == rj) == (ri.empty() && rj.empty())); | ||||
|     else | ||||
|         assert((ri == rj) == (ri.start() == rj.start() && ri.finish() == rj.finish())); | ||||
|  | ||||
|     assert((ri == rj) == !(ri != rj)); | ||||
|  | ||||
|     bool same = ri == rj; | ||||
|     bool one_empty = ri.empty() != rj.empty(); | ||||
|  | ||||
|     std::less<range> less; | ||||
|     std::less_equal<range> less_equal; | ||||
|     std::greater<range> greater; | ||||
|     std::greater_equal<range> greater_equal; | ||||
|      | ||||
|     if (same) | ||||
|     { | ||||
|         assert(greater_equal(ri,rj)); | ||||
|         assert(less_equal(ri,rj)); | ||||
|         assert(!greater(ri,rj)); | ||||
|         assert(!less(ri,rj)); | ||||
|     } | ||||
|     else if (one_empty) | ||||
|     { | ||||
|         const range& empty = ri.empty() ? ri : rj; | ||||
|         const range& non_empty = rj.empty() ? ri : rj; | ||||
|          | ||||
|         assert(less(empty,non_empty)); | ||||
|         assert(less_equal(empty,non_empty)); | ||||
|         assert(!greater(empty,non_empty)); | ||||
|         assert(!greater_equal(empty,non_empty)); | ||||
|         assert(!less(non_empty,empty)); | ||||
|         assert(!less_equal(non_empty,empty)); | ||||
|         assert(greater(non_empty,empty)); | ||||
|         assert(greater_equal(non_empty,empty)); | ||||
|     } | ||||
|     else { | ||||
|         if (indices[i][0] < indices[j][0] || | ||||
|             indices[i][0] == indices[j][0] && indices[i][1] < indices[j][1]) | ||||
|         { | ||||
|             assert(!greater_equal(ri,rj)); | ||||
|             assert(less(ri,rj)); | ||||
|         } | ||||
|  | ||||
|         if (indices[i][0] < indices[j][0] || | ||||
|             indices[i][0] == indices[j][0] && indices[i][1] <= indices[j][1]) | ||||
|         { | ||||
|             assert(!greater(ri,rj)); | ||||
|             assert(less_equal(ri,rj)); | ||||
|         } | ||||
|  | ||||
|         if (indices[i][0] > indices[j][0] || | ||||
|             indices[i][0] == indices[j][0] && indices[i][1] > indices[j][1]) | ||||
|         { | ||||
|             assert(!less_equal(ri,rj)); | ||||
|             assert(greater(ri,rj)); | ||||
|         } | ||||
|  | ||||
|         if (indices[i][0] > indices[j][0] || | ||||
|             indices[i][0] == indices[j][0] && indices[i][1] >= indices[j][1]) | ||||
|         { | ||||
|             assert(!less(ri,rj)); | ||||
|             assert(greater_equal(ri,rj)); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
|  | ||||
| template <class Range> | ||||
| void category_test_2( | ||||
|     const std::vector<Range>&, unsigned, unsigned, std::forward_iterator_tag) | ||||
| { | ||||
| } | ||||
|  | ||||
| template <class T> | ||||
| void category_test_2( | ||||
|     const std::vector<boost::half_open_range<T> >&, unsigned, unsigned, std::bidirectional_iterator_tag) | ||||
| { | ||||
| } | ||||
|  | ||||
| template <class Range> | ||||
| void test_back(Range& x, std::bidirectional_iterator_tag) | ||||
| { | ||||
|     assert(x.back() == boost::prior(x.finish())); | ||||
| } | ||||
|  | ||||
| template <class Range> | ||||
| void test_back(Range& x, std::forward_iterator_tag) | ||||
| { | ||||
| } | ||||
|  | ||||
| template <class T> | ||||
| boost::half_open_range<T> range_identity(const boost::half_open_range<T>& x) | ||||
| { | ||||
|     return x; | ||||
| } | ||||
|  | ||||
| template <class T> | ||||
| void test(T x0, T x1, T x2, T x3) | ||||
| { | ||||
|     std::vector<boost::half_open_range<T> > ranges; | ||||
|     typedef boost::half_open_range<T> range; | ||||
|  | ||||
|     T bounds[4] = { x0, x1, x2, x3 }; | ||||
|  | ||||
|     const std::size_t num_ranges = sizeof(indices)/sizeof(*indices); | ||||
|     // test construction | ||||
|     for (std::size_t n = 0; n < num_ranges;++n) | ||||
|     { | ||||
|         T start = bounds[indices[n][0]]; | ||||
|         T finish = bounds[indices[n][1]]; | ||||
|         boost::half_open_range<T> r(start, finish); | ||||
|         ranges.push_back(r); | ||||
|     } | ||||
|      | ||||
|     // test implicit conversion from std::pair<T,T> | ||||
|     range converted = std::pair<T,T>(x0,x0); | ||||
|     (void)converted; | ||||
|  | ||||
|     // test assignment, equality and inequality | ||||
|     range r00 = range(x0, x0); | ||||
|     assert(r00 == range(x0,x0)); | ||||
|     assert(r00 == range(x1,x1)); // empty ranges are all equal | ||||
|     if (x3 != x0) | ||||
|         assert(r00 != range(x0, x3)); | ||||
|     r00 = range(x0, x3); | ||||
|     assert(r00 == range(x0, x3)); | ||||
|     if (x3 != x0) | ||||
|         assert(r00 != range(x0, x0)); | ||||
|  | ||||
|     typedef typename range::iterator iterator; | ||||
|     typedef typename iterator::iterator_category category; | ||||
|      | ||||
|     for (unsigned i = 0; i < num_ranges; ++i) | ||||
|     { | ||||
|         const range& r = ranges[i]; | ||||
|              | ||||
|         // test begin(), end(), basic iteration. | ||||
|         unsigned count = 0; | ||||
|         for (range::const_iterator p = r.begin(), finish = r.end(); | ||||
|              p != finish; | ||||
|              ++p, ++count) | ||||
|         { | ||||
|             assert(count < 2100); | ||||
|         } | ||||
|  | ||||
|         // test size(), empty(), front(), back() | ||||
|         assert((unsigned)r.size() == count); | ||||
|         if (indices[i][0] == indices[i][1]) | ||||
|             assert(r.empty()); | ||||
|         if (r.empty()) | ||||
|             assert(r.size() == 0); | ||||
|         if (!r.empty()) | ||||
|         { | ||||
|             assert(r.front() == r.start()); | ||||
|             test_back(r, category()); | ||||
|         } | ||||
|  | ||||
|             // test swap | ||||
|         range r1(r); | ||||
|         range r2(x0,x3); | ||||
|         const bool same = r1 == r2; | ||||
|         r1.swap(r2); | ||||
|         assert(r1 == range(x0,x3)); | ||||
|         assert(r2 == r); | ||||
|         if (!same) { | ||||
|             assert(r1 != r); | ||||
|             assert(r2 != range(x0,x3)); | ||||
|         } | ||||
|  | ||||
|         // do individual tests for random-access iterators | ||||
|         category_test_1(r, category()); | ||||
|     } | ||||
|  | ||||
|     for (unsigned j = 0; j < num_ranges; ++j) { | ||||
|         for (unsigned k = 0; k < num_ranges; ++k) { | ||||
|             category_test_2(ranges, j, k, category()); | ||||
|         } | ||||
|     } | ||||
|      | ||||
| } | ||||
|  | ||||
| template <class Integer> | ||||
| void test_integer(Integer* = 0) // default arg works around MSVC bug | ||||
| { | ||||
|     Integer a = 0; | ||||
|     Integer b = a + unsigned_random(128 - a); | ||||
|     Integer c = b + unsigned_random(128 - b); | ||||
|     Integer d = c + unsigned_random(128 - c); | ||||
|  | ||||
|     test(a, b, c, d); | ||||
| } | ||||
|  | ||||
| template <class Container> | ||||
| void test_container(Container* = 0)  // default arg works around MSVC bug | ||||
| { | ||||
|     Container c(unsigned_random(1673)); | ||||
|  | ||||
|     const typename Container::size_type offset1 = unsigned_random(c.size()); | ||||
|     const typename Container::size_type offset2 = unsigned_random(c.size() - offset1); | ||||
|     typename Container::iterator internal1 = c.begin(); | ||||
|     std::advance(internal1, offset1); | ||||
|     typename Container::iterator internal2 = internal1; | ||||
|     std::advance(internal2, offset2); | ||||
|      | ||||
|     test(c.begin(), internal1, internal2, c.end()); | ||||
|  | ||||
|     typedef typename Container::const_iterator const_iterator; | ||||
|     test(const_iterator(c.begin()), | ||||
|          const_iterator(internal1), | ||||
|          const_iterator(internal2), | ||||
|          const_iterator(c.end())); | ||||
| } | ||||
|  | ||||
| int main() | ||||
| { | ||||
|     // Test the built-in integer types. | ||||
|     test_integer<char>(); | ||||
|     test_integer<unsigned char>(); | ||||
|     test_integer<signed char>(); | ||||
|     test_integer<wchar_t>(); | ||||
|     test_integer<short>(); | ||||
|     test_integer<unsigned short>(); | ||||
|     test_integer<int>(); | ||||
|     test_integer<unsigned int>(); | ||||
|     test_integer<long>(); | ||||
|     test_integer<unsigned long>(); | ||||
| #if defined(BOOST_HAS_LONG_LONG) | ||||
|     test_integer<long long>(); | ||||
|     test_integer<unsigned long long>(); | ||||
| #endif | ||||
|     // Some tests on container iterators, to prove we handle a few different categories | ||||
|     test_container<std::vector<int> >(); | ||||
|     test_container<std::list<int> >(); | ||||
| #ifndef BOOST_NO_SLIST | ||||
|     test_container<BOOST_STD_EXTENSION_NAMESPACE::slist<int> >(); | ||||
| #endif | ||||
|     // Also prove that we can handle raw pointers. | ||||
|     int array[2000]; | ||||
|     const std::size_t a = 0; | ||||
|     const std::size_t b = a + unsigned_random(2000 - a); | ||||
|     const std::size_t c = b + unsigned_random(2000 - b); | ||||
|     test(array, array+b, array+c, array+2000); | ||||
|     return 0; | ||||
| } | ||||
							
								
								
									
										297
									
								
								in_place_factories.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										297
									
								
								in_place_factories.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,297 @@ | ||||
| <!DOCTYPE HTML PUBLIC "-//SoftQuad Software//DTD HoTMetaL PRO 5.0::19981217::extensions to HTML 4.0//EN" "hmpro5.dtd"> | ||||
|  | ||||
| <HTML> | ||||
|  | ||||
| <HEAD> | ||||
| <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> | ||||
| <LINK REL="stylesheet" TYPE="text/css" HREF="../../boost.css"> | ||||
| <TITLE>Header </TITLE> | ||||
| </HEAD> | ||||
|  | ||||
| <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080"> | ||||
| <H2 align="left"><IMG SRC="../../boost.png" WIDTH="276" HEIGHT="86"></H2> | ||||
|  | ||||
| <blockquote> | ||||
|   <blockquote> | ||||
|     <blockquote> | ||||
|       <blockquote> | ||||
|         <blockquote> | ||||
|           <blockquote> | ||||
| <H2 align="left">Header <<A | ||||
| HREF="../../boost/utility/in_place_factory.hpp">boost/utility/in_place_factory.hpp</A>> </H2> | ||||
|  | ||||
| <H2 align="left">Header <<A | ||||
| HREF="../../boost/utility/typed_in_place_factory.hpp">boost/utility/typed_in_place_factory.hpp</A>> </H2> | ||||
|  | ||||
|           </blockquote> | ||||
|         </blockquote> | ||||
|       </blockquote> | ||||
|     </blockquote> | ||||
|   </blockquote> | ||||
| </blockquote> | ||||
| <p> </p> | ||||
|  | ||||
| <H2>Contents</H2> | ||||
| <DL CLASS="page-index"> | ||||
|   <DT><A HREF="#mot">Motivation</A></DT> | ||||
|   <DT><A HREF="#framework">Framework</A></DT> | ||||
|   <DT><A HREF="#specification">Specification</A></DT> | ||||
|   <DT><A HREF="#container-usage">Container-side Usage</A></DT> | ||||
|   <DT><A HREF="#user-usage">User-side Usage</A></DT> | ||||
| </DL> | ||||
|  | ||||
| <HR> | ||||
|  | ||||
| <H2><A NAME="mot"></A>Motivation</H2> | ||||
|  | ||||
| <p>Suppose we have a class</p> | ||||
| <pre>struct X | ||||
| { | ||||
|   X ( int, std:::string ) ; | ||||
| } ;</pre> | ||||
| <p>And a container for it which supports an empty state (that is, which can contain zero objects):</p> | ||||
| <pre>struct C | ||||
| { | ||||
|    C() : contained_(0) {} | ||||
|   ~C() { delete contained_ ; } | ||||
|   X* contained_ ; | ||||
| } ;</pre> | ||||
| <p>A container designed to support an empty state typically doesn't require the contained type to be DefaultConstructible, | ||||
| but it typically requires it to be CopyConstructible as a mechanism to | ||||
| initialize the object to store:</p> | ||||
| <pre>struct C | ||||
| { | ||||
|    C() : contained_(0) {} | ||||
|    C ( X const& v ) : contained_ ( new X(v) ) {} | ||||
|   ~C() { delete contained_ ; } | ||||
|   X* contained_ ; | ||||
| } ;</pre> | ||||
| <p>There is a subtle problem with this: since the mechanism used to initialize the stored object is copy construction, | ||||
| there must exist a previously constructed source object to copy from. This | ||||
| object is likely to be temporary and serve no purpose besides being the source</p> | ||||
| <pre>void foo() | ||||
| { | ||||
|   // Temporary object created. | ||||
|   C c( X(123,"hello") ) ; | ||||
| } | ||||
| </pre> | ||||
| <p>A solution to this problem is to support direct construction of the contained | ||||
| object right in the container's storage.<br> | ||||
| In this shceme, the user supplies the arguments for the X constructor | ||||
| directly to the container:</p> | ||||
| <pre>struct C | ||||
| { | ||||
|    C() : contained_(0) {} | ||||
|    C ( X const& v ) : contained_ ( new X(v) ) {} | ||||
|    C ( int a0, std::string a1 ) : contained_ ( new X(a0,a1) ) {} | ||||
|   ~C() { delete contained_ ; } | ||||
|   X* contained_ ; | ||||
| } ;</pre> | ||||
| <pre>void foo() | ||||
| { | ||||
|   // Wrapped object constructed in-place | ||||
|   // No temporary created. | ||||
|   C c(123,"hello") ; | ||||
| } | ||||
| </pre> | ||||
| <p>Clearly, this solution doesn't scale well since the container must duplicate all the constructor overloads from the contained type | ||||
| (at least all those which are to be supported directly in the container).</p> | ||||
|  | ||||
| <H2><A NAME="framework"></A>Framework</H2> | ||||
| <p> | ||||
| This library proposes a framework to allow some containers to directly contruct contained objects in-place without requiring | ||||
| the entire set of constructor overloads ftom the contained type. It also allows the container to remove the CopyConstuctible | ||||
| requirement from the contained type since objects can be directly constructed in-place without need of a copy.<br> | ||||
| The only requirement on the container is that it must provide proper storage (that is, correctly aligned and sized). | ||||
| Naturally, the container will typically support uninitialized storage to avoid the in-place construction to override | ||||
| a fully-constructed object (as this would defeat the purpose of in-place construction) | ||||
| </p> | ||||
| <p>For this purpose, the framework provides two families of classes collectively called: InPlaceFactories and TypedInPlaceFactories.<br> | ||||
| Essentially, these classes hold a sequence of actual parameters and a method to contruct an object in place using these parameters. | ||||
| Each member of the family differs only in the number (and type) of the parameter list. The first family | ||||
| takes the type of the object to construct directly in method provided for that | ||||
| purpose, whereas the second family incorporates that type in the factory class | ||||
| itself..</p> | ||||
| <p>From the container POV, using the framework amounts to calling the factory's method to contruct the object in place. | ||||
| From the user POV, it amounts to creating the right factory object to hold the parameters and pass it to the container.<br> | ||||
| The following simplified example shows the basic idea. A complete example follows the formal specification of the framework:</p> | ||||
| <pre>struct C | ||||
| { | ||||
|    template<class InPlaceFactory> | ||||
|    C ( InPlaceFactory const& aFactoty ) | ||||
|     : | ||||
|     contained_ ( uninitialized_storage() ) | ||||
|    { | ||||
|      aFactory.template apply<X>(contained_); | ||||
|    } | ||||
|  | ||||
|   ~C()  | ||||
|   {  | ||||
|     contained_ -> X::~X(); | ||||
|     delete[] contained_ ;  | ||||
|   } | ||||
|  | ||||
|   char* uninitialized_storage() { return new char[sizeof(X)] ; } | ||||
|  | ||||
|   char* contained_ ; | ||||
| } ; | ||||
|  | ||||
| void foo() | ||||
| { | ||||
|   C c( in_place(123,"hello" ) ; | ||||
| } | ||||
| </pre> | ||||
|  | ||||
| <HR> | ||||
|  | ||||
| <H2><A NAME="specification">Specification</A></H2> | ||||
|  | ||||
| <p>The following is the first member of the family of 'in_place_factory' classes, along with its corresponding helper template function. | ||||
| The rest of the family varies only in the number and type of template (and constructor) parameters.</p> | ||||
| <PRE>namespace boost { | ||||
|  | ||||
| struct in_place_factory_base {} ; | ||||
|  | ||||
| template<class A0> | ||||
| class in_place_factory : public in_place_factory_base | ||||
| { | ||||
|   public:</PRE> | ||||
|  | ||||
| <PRE>    in_place_factory ( A0 const& a0 ) : m_a0(a0) {} | ||||
|  | ||||
|     template< class T > | ||||
|     void apply ( void* address ) const | ||||
|     { | ||||
|       new (address) T(m_a0); | ||||
|     } | ||||
|  | ||||
|   private:</PRE> | ||||
|  | ||||
| <PRE>    A0 const& m_a0 ; | ||||
| } ; | ||||
|  | ||||
| template<class A0> | ||||
| in_place_factory<A0> in_place ( A0 const& a0 ) | ||||
| { | ||||
|   return in_place_factory<A0>(a0); | ||||
| } | ||||
| </PRE> | ||||
|  | ||||
| <p>Similarly, the following is the first member of the family of 'typed_in_place_factory' classes, along with its corresponding | ||||
| helper template function. The rest of the family varies only in the number and type of template (and constructor) parameters.</p> | ||||
| <PRE>namespace boost { | ||||
|  | ||||
| struct typed_in_place_factory_base {} ; | ||||
|  | ||||
| template<class T, class A0> | ||||
| class typed_in_place_factory : public typed_in_place_factory_base | ||||
| { | ||||
|   public:</PRE> | ||||
|  | ||||
| <PRE>    typed_in_place_factory ( A0 const& a0 ) : m_a0(a0) {} | ||||
|  | ||||
|     void apply ( void* address ) const | ||||
|     { | ||||
|       new (address) T(m_a0); | ||||
|     } | ||||
|  | ||||
|   private:</PRE> | ||||
|  | ||||
| <PRE>    A0 const& m_a0 ; | ||||
| } ; | ||||
|  | ||||
| template<class T, class A0> | ||||
| typed_in_place_factory<A0> in_place ( A0 const& a0 ) | ||||
| { | ||||
|   return typed_in_place_factory<T,A0>(a0); | ||||
| }</PRE> | ||||
|  | ||||
| <PRE>} | ||||
| </PRE> | ||||
|  | ||||
| <p>As you can see, the 'in_place_factory' and 'typed_in_place_factory' template classes varies only in the way they specify | ||||
| the target type: in the first family, the type is given as a template argument to the apply member function while in the | ||||
| second it is given directly as part of the factory class.<br> | ||||
| When the container holds a unique non-polymorphic type (such as the case of Boost.Optional), it knows the exact dynamic-type | ||||
| of the contained object and can pass it to the apply() method of a (non-typed) factory. | ||||
| In this case, end users can use an 'in_place_factory' instance which can be constructed without the type of the object to construct.<br> | ||||
| However, if the container holds heterogeneous or polymorphic objects (such as the case of Boost.Variant), the dynamic-type | ||||
| of the object to be constructed must be known by the factory itslef. In this case, end users must use a 'typed_in_place_factory' | ||||
| instead.</p> | ||||
|  | ||||
| <HR> | ||||
|  | ||||
| <h2><A NAME="container-usage">Container-side Usage</a></h2> | ||||
|  | ||||
| <p>As shown in the introductory simplified example, the container class must | ||||
| contain methods that accept an instance of | ||||
| these factories and pass the object's storage to the factory's apply method.<br> | ||||
| However, the type of the factory class cannot be completly specified in the container class because that would | ||||
| defeat the whole purpose of the factories which is to allow the container to accept a variadic argument list | ||||
| for the constructor of its contained object.<br> | ||||
| The correct function overload must be based on the only distinctive and common | ||||
| characteristic of all the classes in each family, the base class.<br> | ||||
| Depending on the container class, you can use 'enable_if' to generate the right overload, or use the following | ||||
| dispatch technique (used in the Boost.Optional class): | ||||
| </p> | ||||
| <pre>struct C | ||||
| { | ||||
|    C() : contained_(0) {} | ||||
|    C ( X const& v ) : contained_ ( new X(v) ) {} | ||||
|  | ||||
|    template<class Expr> | ||||
|    C ( Expr const& expr ) | ||||
|     : | ||||
|     contained_ ( uninitialized_storage() ) | ||||
|    { | ||||
|     construct(expr,&expr) | ||||
|    } | ||||
|  | ||||
|   ~C() { delete contained_ ; } | ||||
|  | ||||
|   template<class InPlaceFactory> | ||||
|   void construct ( InPlaceFactory const& aFactory, boost::in_place_factory_base* ) | ||||
|   { | ||||
|     aFactory.template apply<X>(contained_); | ||||
|   } | ||||
|  | ||||
|   template<class TypedInPlaceFactory> | ||||
|   void construct ( TypedInPlaceFactory const& aFactory, boost::typed_in_place_factory_base* ) | ||||
|   { | ||||
|     aFactory.apply(contained_); | ||||
|   } | ||||
|  | ||||
|   X* uninitialized_storage() { return static_cast<X*>(new char[sizeof(X)]) ; } | ||||
|  | ||||
|   X* contained_ ; | ||||
| } ; | ||||
| </pre> | ||||
|  | ||||
| <hr> | ||||
|  | ||||
| <h2><A NAME="user-usage">User-side Usage</a></h2> | ||||
|  | ||||
| <p>End users pass to the container an instance of a factory object holding the actual parameters needed to construct the | ||||
| contained object directly within the container. For this, the helper template function 'in_place' is used.<br> | ||||
| The call 'in_place(a0,a1,a2,...,an)' constructs a (non-typed) 'in_place_factory' instance with the given argument list.<br> | ||||
| The call 'in_place<T>(a0,a1,a2,...,an)' constructs a 'typed_in_place_factory' instance with the given argument list for the | ||||
| type 'T'.</p> | ||||
| <pre>void foo() | ||||
| { | ||||
|   C a( in_place(123,"hello") ) ;    // in_place_factory passed | ||||
|   C b( in_place<X>(456,"world") ) ; // typed_in_place_factory passed | ||||
| } | ||||
| </pre> | ||||
|  | ||||
| <P>Revised September 17, 2004</P> | ||||
| <p><EFBFBD> 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"> | ||||
| LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt"> | ||||
| www.boost.org/LICENSE_1_0.txt</a>)</p> | ||||
| <P>Developed by <A HREF="mailto:fernando_cacciola@hotmail.com">Fernando Cacciola</A>, | ||||
| the latest version of this file can be found at <A | ||||
| HREF="http://www.boost.org">www.boost.org</A>, and the boost | ||||
| <A HREF="http://www.boost.org/more/mailing_lists.htm#main">discussion lists</A></P> | ||||
| </BODY> | ||||
| </HTML> | ||||
| @@ -3,10 +3,9 @@ | ||||
| // | ||||
| //  Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. | ||||
| // | ||||
| //  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. | ||||
| // Distributed under the Boost Software License, Version 1.0. (See | ||||
| // accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
| //  Note: There are no include guards. This is intentional. | ||||
| // | ||||
| @@ -33,6 +32,6 @@ void assertion_failed(char const * expr, char const * function, char const * fil | ||||
| #define BOOST_ASSERT(expr) ((expr)? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__)) | ||||
|  | ||||
| #else | ||||
| # include <assert.h> | ||||
| # include <assert.h> // .h to support old libraries w/o <cassert> - effect is the same | ||||
| # define BOOST_ASSERT(expr) assert(expr) | ||||
| #endif | ||||
|   | ||||
| @@ -10,15 +10,13 @@ | ||||
| // | ||||
| //  boost/checked_delete.hpp | ||||
| // | ||||
| //  Copyright (c) 1999, 2000, 2001, 2002 boost.org | ||||
| //  Copyright (c) 2002, 2003 Peter Dimov | ||||
| //  Copyright (c) 2003 Daniel Frey | ||||
| //  Copyright (c) 2003 Howard Hinnant | ||||
| // | ||||
| //  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. | ||||
| //  Distributed under the Boost Software License, Version 1.0. (See | ||||
| //  accompanying file LICENSE_1_0.txt or copy at | ||||
| //  http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
| //  See http://www.boost.org/libs/utility/checked_delete.html for documentation. | ||||
| // | ||||
|   | ||||
| @@ -12,10 +12,9 @@ | ||||
| // | ||||
| //  Copyright (c) 2002 Peter Dimov and Multi Media Ltd. | ||||
| // | ||||
| //  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. | ||||
| // Distributed under the Boost Software License, Version 1.0. (See | ||||
| // accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
| //  http://www.boost.org/libs/utility/current_function.html | ||||
| // | ||||
|   | ||||
| @@ -25,6 +25,7 @@ | ||||
|  | ||||
| #include <boost/type_traits/is_arithmetic.hpp> | ||||
| #include <boost/type_traits/is_pointer.hpp> | ||||
| #include <boost/detail/workaround.hpp> | ||||
|  | ||||
| namespace boost{ | ||||
|  | ||||
| @@ -57,7 +58,7 @@ struct ct_imp<T, isp, true> | ||||
| template <typename T, bool b1> | ||||
| struct ct_imp<T, true, b1> | ||||
| { | ||||
|    typedef T const param_type; | ||||
|    typedef const T param_type; | ||||
| }; | ||||
|  | ||||
| } | ||||
| @@ -75,7 +76,7 @@ public: | ||||
|    // however compiler bugs prevent this - instead pass three bool's to | ||||
|    // ct_imp<T,bool,bool,bool> and add an extra partial specialisation | ||||
|    // of ct_imp to handle the logic. (JM) | ||||
|    typedef typename detail::ct_imp< | ||||
|    typedef typename boost::detail::ct_imp< | ||||
|       T, | ||||
|       ::boost::is_pointer<T>::value, | ||||
|       ::boost::is_arithmetic<T>::value | ||||
| @@ -91,7 +92,7 @@ struct call_traits<T&> | ||||
|    typedef T& param_type;  // hh removed const | ||||
| }; | ||||
|  | ||||
| #if defined(__BORLANDC__) && (__BORLANDC__ <= 0x560) | ||||
| #if BOOST_WORKAROUND( __BORLANDC__,  BOOST_TESTED_AT( 0x581 ) ) | ||||
| // these are illegal specialisations; cv-qualifies applied to | ||||
| // references have no effect according to [8.3.2p1], | ||||
| // C++ Builder requires them though as it treats cv-qualified | ||||
| @@ -120,6 +121,15 @@ struct call_traits<T&const volatile> | ||||
|    typedef const T& const_reference; | ||||
|    typedef T& param_type;  // hh removed const | ||||
| }; | ||||
|  | ||||
| template <typename T> | ||||
| struct call_traits< T * > | ||||
| { | ||||
|    typedef T * value_type; | ||||
|    typedef T * & reference; | ||||
|    typedef T * const & const_reference; | ||||
|    typedef T * const param_type;  // hh removed const | ||||
| }; | ||||
| #endif | ||||
| #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) | ||||
| template <typename T, std::size_t N> | ||||
|   | ||||
| @@ -27,6 +27,10 @@ | ||||
| #include <boost/type_traits/is_same.hpp> | ||||
| #include <boost/call_traits.hpp> | ||||
|  | ||||
| #ifdef BOOST_MSVC | ||||
| # pragma warning(push) | ||||
| # pragma warning(disable:4512) | ||||
| #endif  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
| @@ -132,7 +136,7 @@ namespace details | ||||
|  | ||||
|    template <class T1, class T2> | ||||
|    class compressed_pair_imp<T1, T2, 1> | ||||
|       : private T1 | ||||
|       : protected ::boost::remove_cv<T1>::type | ||||
|    { | ||||
|    public: | ||||
|       typedef T1                                                 first_type; | ||||
| @@ -174,7 +178,7 @@ namespace details | ||||
|  | ||||
|    template <class T1, class T2> | ||||
|    class compressed_pair_imp<T1, T2, 2> | ||||
|       : private T2 | ||||
|       : protected ::boost::remove_cv<T2>::type | ||||
|    { | ||||
|    public: | ||||
|       typedef T1                                                 first_type; | ||||
| @@ -217,8 +221,8 @@ namespace details | ||||
|  | ||||
|    template <class T1, class T2> | ||||
|    class compressed_pair_imp<T1, T2, 3> | ||||
|       : private T1, | ||||
|         private T2 | ||||
|       : protected ::boost::remove_cv<T1>::type, | ||||
|         protected ::boost::remove_cv<T2>::type | ||||
|    { | ||||
|    public: | ||||
|       typedef T1                                                 first_type; | ||||
| @@ -253,11 +257,14 @@ namespace details | ||||
|  | ||||
|    // JM | ||||
|    // 4    T1 == T2, T1 and T2 both empty | ||||
|    //      Note does not actually store an instance of T2 at all - | ||||
|    //      but reuses T1 base class for both first() and second(). | ||||
|    //      Originally this did not store an instance of T2 at all | ||||
|    //      but that led to problems beause it meant &x.first() == &x.second() | ||||
|    //      which is not true for any other kind of pair, so now we store an instance | ||||
|    //      of T2 just in case the user is relying on first() and second() returning | ||||
|    //      different objects (albeit both empty). | ||||
|    template <class T1, class T2> | ||||
|    class compressed_pair_imp<T1, T2, 4> | ||||
|       : private T1 | ||||
|       : protected ::boost::remove_cv<T1>::type | ||||
|    { | ||||
|    public: | ||||
|       typedef T1                                                 first_type; | ||||
| @@ -428,7 +435,9 @@ swap(compressed_pair<T1, T2>& x, compressed_pair<T1, T2>& y) | ||||
|  | ||||
| } // boost | ||||
|  | ||||
| #ifdef BOOST_MSVC | ||||
| # pragma warning(pop) | ||||
| #endif  | ||||
|  | ||||
| #endif // BOOST_DETAIL_COMPRESSED_PAIR_HPP | ||||
|  | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -1,8 +1,7 @@ | ||||
| // (C) Copyright Jens Maurer 2001. 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. | ||||
| // (C) Copyright Jens Maurer 2001. | ||||
| // Distributed under the Boost Software License, Version 1.0. (See | ||||
| // accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
| // Revision History: | ||||
|  | ||||
|   | ||||
| @@ -1,10 +1,8 @@ | ||||
| //  Boost next_prior.hpp header file  ---------------------------------------// | ||||
|  | ||||
| //  (C) Copyright Boost.org 1999-2003. 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. | ||||
| //  (C) Copyright Dave Abrahams and Daniel Walker 1999-2003. Distributed under the Boost | ||||
| //  Software License, Version 1.0. (See accompanying file | ||||
| //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||||
|  | ||||
| //  See http://www.boost.org/libs/utility for documentation. | ||||
|  | ||||
|   | ||||
| @@ -1,10 +1,8 @@ | ||||
| //  Boost noncopyable.hpp header file  --------------------------------------// | ||||
|  | ||||
| //  (C) Copyright Boost.org 1999-2003. 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. | ||||
| //  (C) Copyright Beman Dawes 1999-2003. Distributed under the Boost | ||||
| //  Software License, Version 1.0. (See accompanying file | ||||
| //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||||
|  | ||||
| //  See http://www.boost.org/libs/utility for documentation. | ||||
|  | ||||
| @@ -18,15 +16,20 @@ namespace boost { | ||||
|  | ||||
| //  Contributed by Dave Abrahams | ||||
|  | ||||
| class noncopyable | ||||
| namespace noncopyable_  // protection from unintended ADL | ||||
| { | ||||
|  protected: | ||||
|     noncopyable() {} | ||||
|     ~noncopyable() {} | ||||
|  private:  // emphasize the following members are private | ||||
|     noncopyable( const noncopyable& ); | ||||
|     const noncopyable& operator=( const noncopyable& ); | ||||
| }; | ||||
|   class noncopyable | ||||
|   { | ||||
|    protected: | ||||
|       noncopyable() {} | ||||
|       ~noncopyable() {} | ||||
|    private:  // emphasize the following members are private | ||||
|       noncopyable( const noncopyable& ); | ||||
|       const noncopyable& operator=( const noncopyable& ); | ||||
|   }; | ||||
| } | ||||
|  | ||||
| typedef noncopyable_::noncopyable noncopyable; | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
|   | ||||
| @@ -1,14 +1,15 @@ | ||||
| //  Boost operators.hpp header file  ----------------------------------------// | ||||
|  | ||||
| //  (C) Copyright David Abrahams, Jeremy Siek, and Daryle Walker 1999-2001. | ||||
| //  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. | ||||
| //  (C) Copyright David Abrahams, Jeremy Siek, Daryle Walker 1999-2001. | ||||
| //  Distributed under the Boost Software License, Version 1.0. (See | ||||
| //  accompanying file LICENSE_1_0.txt or copy at | ||||
| //  http://www.boost.org/LICENSE_1_0.txt) | ||||
|  | ||||
| //  See http://www.boost.org/libs/utility/operators.htm for documentation. | ||||
|  | ||||
| //  Revision History | ||||
| //  24 May 07 Changed empty_base to depend on T, see | ||||
| //            http://svn.boost.org/trac/boost/ticket/979 | ||||
| //  21 Oct 02 Modified implementation of operators to allow compilers with a | ||||
| //            correct named return value optimization (NRVO) to produce optimal | ||||
| //            code.  (Daniel Frey) | ||||
| @@ -91,15 +92,15 @@ | ||||
| namespace boost { | ||||
| namespace detail { | ||||
|  | ||||
| template <typename T> class empty_base { | ||||
|  | ||||
| // Helmut Zeisel, empty base class optimization bug with GCC 3.0.0 | ||||
| #if defined(__GNUC__) && __GNUC__==3 && __GNUC_MINOR__==0 && __GNU_PATCHLEVEL__==0 | ||||
| class empty_base { | ||||
|   bool dummy;  | ||||
| }; | ||||
| #else | ||||
| class empty_base {}; | ||||
| #endif | ||||
|  | ||||
| }; | ||||
|  | ||||
| } // namespace detail | ||||
| } // namespace boost | ||||
|  | ||||
| @@ -120,7 +121,7 @@ namespace boost | ||||
| //  Note that friend functions defined in a class are implicitly inline. | ||||
| //  See the C++ std, 11.4 [class.friend] paragraph 5 | ||||
|  | ||||
| template <class T, class U, class B = ::boost::detail::empty_base> | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> > | ||||
| struct less_than_comparable2 : B | ||||
| { | ||||
|      friend bool operator<=(const T& x, const U& y) { return !(x > y); } | ||||
| @@ -131,7 +132,7 @@ struct less_than_comparable2 : B | ||||
|      friend bool operator>=(const U& x, const T& y) { return !(y > x); } | ||||
| }; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct less_than_comparable1 : B | ||||
| { | ||||
|      friend bool operator>(const T& x, const T& y)  { return y < x; } | ||||
| @@ -139,7 +140,7 @@ struct less_than_comparable1 : B | ||||
|      friend bool operator>=(const T& x, const T& y) { return !(x < y); } | ||||
| }; | ||||
|  | ||||
| template <class T, class U, class B = ::boost::detail::empty_base> | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> > | ||||
| struct equality_comparable2 : B | ||||
| { | ||||
|      friend bool operator==(const U& y, const T& x) { return x == y; } | ||||
| @@ -147,7 +148,7 @@ struct equality_comparable2 : B | ||||
|      friend bool operator!=(const T& y, const U& x) { return !(y == x); } | ||||
| }; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct equality_comparable1 : B | ||||
| { | ||||
|      friend bool operator!=(const T& x, const T& y) { return !(x == y); } | ||||
| @@ -166,7 +167,7 @@ struct equality_comparable1 : B | ||||
| // implementation available. | ||||
|  | ||||
| #define BOOST_BINARY_OPERATOR_COMMUTATIVE( NAME, OP )                         \ | ||||
| template <class T, class U, class B = ::boost::detail::empty_base>            \ | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> >        \ | ||||
| struct NAME##2 : B                                                            \ | ||||
| {                                                                             \ | ||||
|   friend T operator OP( const T& lhs, const U& rhs )                          \ | ||||
| @@ -175,33 +176,33 @@ struct NAME##2 : B                                                            \ | ||||
|     { T nrv( rhs ); nrv OP##= lhs; return nrv; }                              \ | ||||
| };                                                                            \ | ||||
|                                                                               \ | ||||
| template <class T, class B = ::boost::detail::empty_base>                     \ | ||||
| template <class T, class B = ::boost::detail::empty_base<T> >                 \ | ||||
| struct NAME##1 : B                                                            \ | ||||
| {                                                                             \ | ||||
|   friend T operator OP( const T& lhs, const T& rhs )                          \ | ||||
|     { T nrv( lhs ); nrv OP##= rhs; return nrv; }                              \ | ||||
| }; | ||||
|  | ||||
| #define BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( NAME, OP )           \ | ||||
| template <class T, class U, class B = ::boost::detail::empty_base>  \ | ||||
| struct NAME##2 : B                                                  \ | ||||
| {                                                                   \ | ||||
|   friend T operator OP( const T& lhs, const U& rhs )                \ | ||||
|     { T nrv( lhs ); nrv OP##= rhs; return nrv; }                    \ | ||||
| };                                                                  \ | ||||
|                                                                     \ | ||||
| template <class T, class U, class B = ::boost::detail::empty_base>  \ | ||||
| struct BOOST_OPERATOR2_LEFT(NAME) : B                               \ | ||||
| {                                                                   \ | ||||
|   friend T operator OP( const U& lhs, const T& rhs )                \ | ||||
|     { T nrv( lhs ); nrv OP##= rhs; return nrv; }                    \ | ||||
| };                                                                  \ | ||||
|                                                                     \ | ||||
| template <class T, class B = ::boost::detail::empty_base>           \ | ||||
| struct NAME##1 : B                                                  \ | ||||
| {                                                                   \ | ||||
|   friend T operator OP( const T& lhs, const T& rhs )                \ | ||||
|     { T nrv( lhs ); nrv OP##= rhs; return nrv; }                    \ | ||||
| #define BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( NAME, OP )               \ | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> >  \ | ||||
| struct NAME##2 : B                                                      \ | ||||
| {                                                                       \ | ||||
|   friend T operator OP( const T& lhs, const U& rhs )                    \ | ||||
|     { T nrv( lhs ); nrv OP##= rhs; return nrv; }                        \ | ||||
| };                                                                      \ | ||||
|                                                                         \ | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> >  \ | ||||
| struct BOOST_OPERATOR2_LEFT(NAME) : B                                   \ | ||||
| {                                                                       \ | ||||
|   friend T operator OP( const U& lhs, const T& rhs )                    \ | ||||
|     { T nrv( lhs ); nrv OP##= rhs; return nrv; }                        \ | ||||
| };                                                                      \ | ||||
|                                                                         \ | ||||
| template <class T, class B = ::boost::detail::empty_base<T> >           \ | ||||
| struct NAME##1 : B                                                      \ | ||||
| {                                                                       \ | ||||
|   friend T operator OP( const T& lhs, const T& rhs )                    \ | ||||
|     { T nrv( lhs ); nrv OP##= rhs; return nrv; }                        \ | ||||
| }; | ||||
|  | ||||
| #else // defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS) | ||||
| @@ -211,35 +212,35 @@ struct NAME##1 : B                                                  \ | ||||
| // BOOST_OPERATOR2_LEFT(NAME) only looks cool, but doesn't provide | ||||
| // optimization opportunities to the compiler :) | ||||
|  | ||||
| #define BOOST_BINARY_OPERATOR_COMMUTATIVE( NAME, OP )                         \ | ||||
| template <class T, class U, class B = ::boost::detail::empty_base>            \ | ||||
| struct NAME##2 : B                                                            \ | ||||
| {                                                                             \ | ||||
|   friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; }       \ | ||||
|   friend T operator OP( const U& lhs, T rhs ) { return rhs OP##= lhs; }       \ | ||||
| };                                                                            \ | ||||
|                                                                               \ | ||||
| template <class T, class B = ::boost::detail::empty_base>                     \ | ||||
| struct NAME##1 : B                                                            \ | ||||
| {                                                                             \ | ||||
|   friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; }       \ | ||||
| #define BOOST_BINARY_OPERATOR_COMMUTATIVE( NAME, OP )                   \ | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> >  \ | ||||
| struct NAME##2 : B                                                      \ | ||||
| {                                                                       \ | ||||
|   friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \ | ||||
|   friend T operator OP( const U& lhs, T rhs ) { return rhs OP##= lhs; } \ | ||||
| };                                                                      \ | ||||
|                                                                         \ | ||||
| template <class T, class B = ::boost::detail::empty_base<T> >           \ | ||||
| struct NAME##1 : B                                                      \ | ||||
| {                                                                       \ | ||||
|   friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \ | ||||
| }; | ||||
|  | ||||
| #define BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( NAME, OP )               \ | ||||
| template <class T, class U, class B = ::boost::detail::empty_base>      \ | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> >  \ | ||||
| struct NAME##2 : B                                                      \ | ||||
| {                                                                       \ | ||||
|   friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \ | ||||
| };                                                                      \ | ||||
|                                                                         \ | ||||
| template <class T, class U, class B = ::boost::detail::empty_base>      \ | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> >  \ | ||||
| struct BOOST_OPERATOR2_LEFT(NAME) : B                                   \ | ||||
| {                                                                       \ | ||||
|   friend T operator OP( const U& lhs, const T& rhs )                    \ | ||||
|     { return T( lhs ) OP##= rhs; }                                      \ | ||||
| };                                                                      \ | ||||
|                                                                         \ | ||||
| template <class T, class B = ::boost::detail::empty_base>               \ | ||||
| template <class T, class B = ::boost::detail::empty_base<T> >           \ | ||||
| struct NAME##1 : B                                                      \ | ||||
| {                                                                       \ | ||||
|   friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \ | ||||
| @@ -262,7 +263,7 @@ BOOST_BINARY_OPERATOR_COMMUTATIVE( orable, | ) | ||||
|  | ||||
| //  incrementable and decrementable contributed by Jeremy Siek | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct incrementable : B | ||||
| { | ||||
|   friend T operator++(T& x, int) | ||||
| @@ -275,7 +276,7 @@ private: // The use of this typedef works around a Borland bug | ||||
|   typedef T incrementable_type; | ||||
| }; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct decrementable : B | ||||
| { | ||||
|   friend T operator--(T& x, int) | ||||
| @@ -290,7 +291,7 @@ private: // The use of this typedef works around a Borland bug | ||||
|  | ||||
| //  Iterator operator classes (contributed by Jeremy Siek) ------------------// | ||||
|  | ||||
| template <class T, class P, class B = ::boost::detail::empty_base> | ||||
| template <class T, class P, class B = ::boost::detail::empty_base<T> > | ||||
| struct dereferenceable : B | ||||
| { | ||||
|   P operator->() const | ||||
| @@ -299,7 +300,7 @@ struct dereferenceable : B | ||||
|   } | ||||
| }; | ||||
|  | ||||
| template <class T, class I, class R, class B = ::boost::detail::empty_base> | ||||
| template <class T, class I, class R, class B = ::boost::detail::empty_base<T> > | ||||
| struct indexable : B | ||||
| { | ||||
|   R operator[](I n) const | ||||
| @@ -314,14 +315,14 @@ struct indexable : B | ||||
| #if defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS) | ||||
|  | ||||
| #define BOOST_BINARY_OPERATOR( NAME, OP )                                     \ | ||||
| template <class T, class U, class B = ::boost::detail::empty_base>            \ | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> >        \ | ||||
| struct NAME##2 : B                                                            \ | ||||
| {                                                                             \ | ||||
|   friend T operator OP( const T& lhs, const U& rhs )                          \ | ||||
|     { T nrv( lhs ); nrv OP##= rhs; return nrv; }                              \ | ||||
| };                                                                            \ | ||||
|                                                                               \ | ||||
| template <class T, class B = ::boost::detail::empty_base>                     \ | ||||
| template <class T, class B = ::boost::detail::empty_base<T> >                 \ | ||||
| struct NAME##1 : B                                                            \ | ||||
| {                                                                             \ | ||||
|   friend T operator OP( const T& lhs, const T& rhs )                          \ | ||||
| @@ -331,13 +332,13 @@ struct NAME##1 : B                                                            \ | ||||
| #else // defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS) | ||||
|  | ||||
| #define BOOST_BINARY_OPERATOR( NAME, OP )                                     \ | ||||
| template <class T, class U, class B = ::boost::detail::empty_base>            \ | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> >        \ | ||||
| struct NAME##2 : B                                                            \ | ||||
| {                                                                             \ | ||||
|   friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; }       \ | ||||
| };                                                                            \ | ||||
|                                                                               \ | ||||
| template <class T, class B = ::boost::detail::empty_base>                     \ | ||||
| template <class T, class B = ::boost::detail::empty_base<T> >                 \ | ||||
| struct NAME##1 : B                                                            \ | ||||
| {                                                                             \ | ||||
|   friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; }       \ | ||||
| @@ -350,7 +351,7 @@ BOOST_BINARY_OPERATOR( right_shiftable, >> ) | ||||
|  | ||||
| #undef BOOST_BINARY_OPERATOR | ||||
|  | ||||
| template <class T, class U, class B = ::boost::detail::empty_base> | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> > | ||||
| struct equivalent2 : B | ||||
| { | ||||
|   friend bool operator==(const T& x, const U& y) | ||||
| @@ -359,7 +360,7 @@ struct equivalent2 : B | ||||
|   } | ||||
| }; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct equivalent1 : B | ||||
| { | ||||
|   friend bool operator==(const T&x, const T&y) | ||||
| @@ -368,7 +369,7 @@ struct equivalent1 : B | ||||
|   } | ||||
| }; | ||||
|  | ||||
| template <class T, class U, class B = ::boost::detail::empty_base> | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> > | ||||
| struct partially_ordered2 : B | ||||
| { | ||||
|   friend bool operator<=(const T& x, const U& y) | ||||
| @@ -385,7 +386,7 @@ struct partially_ordered2 : B | ||||
|     { return (y < x) || (y == x); } | ||||
| }; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct partially_ordered1 : B | ||||
| { | ||||
|   friend bool operator>(const T& x, const T& y) | ||||
| @@ -398,161 +399,161 @@ struct partially_ordered1 : B | ||||
|  | ||||
| //  Combined operator classes (contributed by Daryle Walker) ----------------// | ||||
|  | ||||
| template <class T, class U, class B = ::boost::detail::empty_base> | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> > | ||||
| struct totally_ordered2 | ||||
|     : less_than_comparable2<T, U | ||||
|     , equality_comparable2<T, U, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct totally_ordered1 | ||||
|     : less_than_comparable1<T | ||||
|     , equality_comparable1<T, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class U, class B = ::boost::detail::empty_base> | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> > | ||||
| struct additive2 | ||||
|     : addable2<T, U | ||||
|     , subtractable2<T, U, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct additive1 | ||||
|     : addable1<T | ||||
|     , subtractable1<T, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class U, class B = ::boost::detail::empty_base> | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> > | ||||
| struct multiplicative2 | ||||
|     : multipliable2<T, U | ||||
|     , dividable2<T, U, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct multiplicative1 | ||||
|     : multipliable1<T | ||||
|     , dividable1<T, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class U, class B = ::boost::detail::empty_base> | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> > | ||||
| struct integer_multiplicative2 | ||||
|     : multiplicative2<T, U | ||||
|     , modable2<T, U, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct integer_multiplicative1 | ||||
|     : multiplicative1<T | ||||
|     , modable1<T, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class U, class B = ::boost::detail::empty_base> | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> > | ||||
| struct arithmetic2 | ||||
|     : additive2<T, U | ||||
|     , multiplicative2<T, U, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct arithmetic1 | ||||
|     : additive1<T | ||||
|     , multiplicative1<T, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class U, class B = ::boost::detail::empty_base> | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> > | ||||
| struct integer_arithmetic2 | ||||
|     : additive2<T, U | ||||
|     , integer_multiplicative2<T, U, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct integer_arithmetic1 | ||||
|     : additive1<T | ||||
|     , integer_multiplicative1<T, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class U, class B = ::boost::detail::empty_base> | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> > | ||||
| struct bitwise2 | ||||
|     : xorable2<T, U | ||||
|     , andable2<T, U | ||||
|     , orable2<T, U, B | ||||
|       > > > {}; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct bitwise1 | ||||
|     : xorable1<T | ||||
|     , andable1<T | ||||
|     , orable1<T, B | ||||
|       > > > {}; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct unit_steppable | ||||
|     : incrementable<T | ||||
|     , decrementable<T, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class U, class B = ::boost::detail::empty_base> | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> > | ||||
| struct shiftable2 | ||||
|     : left_shiftable2<T, U | ||||
|     , right_shiftable2<T, U, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct shiftable1 | ||||
|     : left_shiftable1<T | ||||
|     , right_shiftable1<T, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class U, class B = ::boost::detail::empty_base> | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> > | ||||
| struct ring_operators2 | ||||
|     : additive2<T, U | ||||
|     , subtractable2_left<T, U | ||||
|     , multipliable2<T, U, B | ||||
|       > > > {}; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct ring_operators1 | ||||
|     : additive1<T | ||||
|     , multipliable1<T, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class U, class B = ::boost::detail::empty_base> | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> > | ||||
| struct ordered_ring_operators2 | ||||
|     : ring_operators2<T, U | ||||
|     , totally_ordered2<T, U, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct ordered_ring_operators1 | ||||
|     : ring_operators1<T | ||||
|     , totally_ordered1<T, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class U, class B = ::boost::detail::empty_base> | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> > | ||||
| struct field_operators2 | ||||
|     : ring_operators2<T, U | ||||
|     , dividable2<T, U | ||||
|     , dividable2_left<T, U, B | ||||
|       > > > {}; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct field_operators1 | ||||
|     : ring_operators1<T | ||||
|     , dividable1<T, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class U, class B = ::boost::detail::empty_base> | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> > | ||||
| struct ordered_field_operators2 | ||||
|     : field_operators2<T, U | ||||
|     , totally_ordered2<T, U, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct ordered_field_operators1 | ||||
|     : field_operators1<T | ||||
|     , totally_ordered1<T, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class U, class B = ::boost::detail::empty_base> | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> > | ||||
| struct euclidian_ring_operators2 | ||||
|     : ring_operators2<T, U | ||||
|     , dividable2<T, U | ||||
| @@ -561,43 +562,43 @@ struct euclidian_ring_operators2 | ||||
|     , modable2_left<T, U, B | ||||
|       > > > > > {}; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct euclidian_ring_operators1 | ||||
|     : ring_operators1<T | ||||
|     , dividable1<T | ||||
|     , modable1<T, B | ||||
|       > > > {}; | ||||
|  | ||||
| template <class T, class U, class B = ::boost::detail::empty_base> | ||||
| template <class T, class U, class B = ::boost::detail::empty_base<T> > | ||||
| struct ordered_euclidian_ring_operators2 | ||||
|     : totally_ordered2<T, U | ||||
|     , euclidian_ring_operators2<T, U, B | ||||
|       > > {}; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct ordered_euclidian_ring_operators1 | ||||
|     : totally_ordered1<T | ||||
|     , euclidian_ring_operators1<T, B | ||||
|       > > {}; | ||||
|        | ||||
| template <class T, class P, class B = ::boost::detail::empty_base> | ||||
| template <class T, class P, class B = ::boost::detail::empty_base<T> > | ||||
| struct input_iteratable | ||||
|     : equality_comparable1<T | ||||
|     , incrementable<T | ||||
|     , dereferenceable<T, P, B | ||||
|       > > > {}; | ||||
|  | ||||
| template <class T, class B = ::boost::detail::empty_base> | ||||
| template <class T, class B = ::boost::detail::empty_base<T> > | ||||
| struct output_iteratable | ||||
|     : incrementable<T, B | ||||
|       > {}; | ||||
|  | ||||
| template <class T, class P, class B = ::boost::detail::empty_base> | ||||
| template <class T, class P, class B = ::boost::detail::empty_base<T> > | ||||
| struct forward_iteratable | ||||
|     : input_iteratable<T, P, B | ||||
|       > {}; | ||||
|  | ||||
| template <class T, class P, class B = ::boost::detail::empty_base> | ||||
| template <class T, class P, class B = ::boost::detail::empty_base<T> > | ||||
| struct bidirectional_iteratable | ||||
|     : forward_iteratable<T, P | ||||
|     , decrementable<T, B | ||||
| @@ -607,7 +608,7 @@ struct bidirectional_iteratable | ||||
| //  which is an indirect base class of bidirectional_iterable, | ||||
| //  random_access_iteratable must not be derived from totally_ordered1 | ||||
| //  but from less_than_comparable1 only. (Helmut Zeisel, 02-Dec-2001) | ||||
| template <class T, class P, class D, class R, class B = ::boost::detail::empty_base> | ||||
| template <class T, class P, class D, class R, class B = ::boost::detail::empty_base<T> > | ||||
| struct random_access_iteratable | ||||
|     : bidirectional_iteratable<T, P | ||||
|     , less_than_comparable1<T | ||||
| @@ -651,20 +652,20 @@ struct random_access_iteratable | ||||
|  | ||||
|      // Otherwise, because a Borland C++ 5.5 bug prevents a using declaration | ||||
|      // from working, we are forced to use inheritance for that compiler. | ||||
| #    define BOOST_IMPORT_TEMPLATE4(template_name)                                          \ | ||||
|      template <class T, class U, class V, class W, class B = ::boost::detail::empty_base>  \ | ||||
| #    define BOOST_IMPORT_TEMPLATE4(template_name)                                             \ | ||||
|      template <class T, class U, class V, class W, class B = ::boost::detail::empty_base<T> > \ | ||||
|      struct template_name : ::template_name<T, U, V, W, B> {}; | ||||
|  | ||||
| #    define BOOST_IMPORT_TEMPLATE3(template_name)                                 \ | ||||
|      template <class T, class U, class V, class B = ::boost::detail::empty_base>  \ | ||||
| #    define BOOST_IMPORT_TEMPLATE3(template_name)                                    \ | ||||
|      template <class T, class U, class V, class B = ::boost::detail::empty_base<T> > \ | ||||
|      struct template_name : ::template_name<T, U, V, B> {}; | ||||
|  | ||||
| #    define BOOST_IMPORT_TEMPLATE2(template_name)                              \ | ||||
|      template <class T, class U, class B = ::boost::detail::empty_base>        \ | ||||
| #    define BOOST_IMPORT_TEMPLATE2(template_name)                           \ | ||||
|      template <class T, class U, class B = ::boost::detail::empty_base<T> > \ | ||||
|      struct template_name : ::template_name<T, U, B> {}; | ||||
|  | ||||
| #    define BOOST_IMPORT_TEMPLATE1(template_name)                              \ | ||||
|      template <class T, class B = ::boost::detail::empty_base>                 \ | ||||
| #    define BOOST_IMPORT_TEMPLATE1(template_name)                  \ | ||||
|      template <class T, class B = ::boost::detail::empty_base<T> > \ | ||||
|      struct template_name : ::template_name<T, B> {}; | ||||
|  | ||||
| #  endif // BOOST_NO_USING_TEMPLATE | ||||
| @@ -675,7 +676,7 @@ struct random_access_iteratable | ||||
| // Here's where we put it all together, defining the xxxx forms of the templates | ||||
| // in namespace boost. We also define specializations of is_chained_base<> for | ||||
| // the xxxx, xxxx1, and xxxx2 templates, importing them into boost:: as | ||||
| // neccessary. | ||||
| // necessary. | ||||
| // | ||||
| #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION | ||||
|  | ||||
| @@ -700,7 +701,7 @@ template<class T> struct is_chained_base { | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| // Import a 4-type-argument operator template into boost (if neccessary) and | ||||
| // Import a 4-type-argument operator template into boost (if necessary) and | ||||
| // provide a specialization of 'is_chained_base<>' for it. | ||||
| # define BOOST_OPERATOR_TEMPLATE4(template_name4)                     \ | ||||
|   BOOST_IMPORT_TEMPLATE4(template_name4)                              \ | ||||
| @@ -709,7 +710,7 @@ template<class T> struct is_chained_base { | ||||
|     typedef ::boost::detail::true_t value;                            \ | ||||
|   }; | ||||
|  | ||||
| // Import a 3-type-argument operator template into boost (if neccessary) and | ||||
| // Import a 3-type-argument operator template into boost (if necessary) and | ||||
| // provide a specialization of 'is_chained_base<>' for it. | ||||
| # define BOOST_OPERATOR_TEMPLATE3(template_name3)                     \ | ||||
|   BOOST_IMPORT_TEMPLATE3(template_name3)                              \ | ||||
| @@ -718,7 +719,7 @@ template<class T> struct is_chained_base { | ||||
|     typedef ::boost::detail::true_t value;                            \ | ||||
|   }; | ||||
|  | ||||
| // Import a 2-type-argument operator template into boost (if neccessary) and | ||||
| // Import a 2-type-argument operator template into boost (if necessary) and | ||||
| // provide a specialization of 'is_chained_base<>' for it. | ||||
| # define BOOST_OPERATOR_TEMPLATE2(template_name2)                  \ | ||||
|   BOOST_IMPORT_TEMPLATE2(template_name2)                           \ | ||||
| @@ -727,7 +728,7 @@ template<class T> struct is_chained_base { | ||||
|     typedef ::boost::detail::true_t value;                         \ | ||||
|   }; | ||||
|  | ||||
| // Import a 1-type-argument operator template into boost (if neccessary) and | ||||
| // Import a 1-type-argument operator template into boost (if necessary) and | ||||
| // provide a specialization of 'is_chained_base<>' for it. | ||||
| # define BOOST_OPERATOR_TEMPLATE1(template_name1)                  \ | ||||
|   BOOST_IMPORT_TEMPLATE1(template_name1)                           \ | ||||
| @@ -753,7 +754,7 @@ template<class T> struct is_chained_base { | ||||
| # define BOOST_OPERATOR_TEMPLATE(template_name)                    \ | ||||
| template <class T                                                  \ | ||||
|          ,class U = T                                              \ | ||||
|          ,class B = ::boost::detail::empty_base                    \ | ||||
|          ,class B = ::boost::detail::empty_base<T>                 \ | ||||
|          ,class O = typename is_chained_base<U>::value             \ | ||||
|          >                                                         \ | ||||
| struct template_name : template_name##2<T, U, B> {};               \ | ||||
| @@ -789,7 +790,7 @@ BOOST_OPERATOR_TEMPLATE1(template_name##1) | ||||
|    // In this case we can only assume that template_name<> is equivalent to the | ||||
|    // more commonly needed template_name1<> form. | ||||
| #  define BOOST_OPERATOR_TEMPLATE(template_name)                   \ | ||||
|    template <class T, class B = ::boost::detail::empty_base>       \ | ||||
|    template <class T, class B = ::boost::detail::empty_base<T> >   \ | ||||
|    struct template_name : template_name##1<T, B> {}; | ||||
|  | ||||
| #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION | ||||
|   | ||||
| @@ -10,6 +10,7 @@ | ||||
| #include <boost/config.hpp> | ||||
| #include <boost/utility/addressof.hpp> | ||||
| #include <boost/mpl/bool.hpp> | ||||
| #include <boost/detail/workaround.hpp> | ||||
|  | ||||
| // | ||||
| //  ref.hpp - ref/cref, useful helper functions | ||||
| @@ -18,10 +19,9 @@ | ||||
| //  Copyright (C) 2001, 2002 Peter Dimov | ||||
| //  Copyright (C) 2002 David Abrahams | ||||
| // | ||||
| //  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. | ||||
| // Distributed under the Boost Software License, Version 1.0. (See | ||||
| // accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
| //  See http://www.boost.org/libs/bind/ref.html for documentation. | ||||
| // | ||||
| @@ -34,7 +34,7 @@ template<class T> class reference_wrapper | ||||
| public: | ||||
|     typedef T type; | ||||
|  | ||||
| #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) | ||||
| #if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1300 ) | ||||
|  | ||||
|     explicit reference_wrapper(T& t): t_(&t) {} | ||||
|  | ||||
| @@ -55,7 +55,7 @@ private: | ||||
|     T* t_; | ||||
| }; | ||||
|  | ||||
| # if defined(__BORLANDC__) && (__BORLANDC__ <= 0x570) | ||||
| # if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) ) | ||||
| #  define BOOST_REF_CONST | ||||
| # else | ||||
| #  define BOOST_REF_CONST const | ||||
| @@ -74,18 +74,13 @@ template<class T> inline reference_wrapper<T const> BOOST_REF_CONST cref(T const | ||||
| # undef BOOST_REF_CONST | ||||
|  | ||||
| # ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION | ||||
|  | ||||
| template<typename T> | ||||
| class is_reference_wrapper | ||||
|     : public mpl::false_ | ||||
| { | ||||
| }; | ||||
|  | ||||
| template<typename T> | ||||
| class is_reference_wrapper<reference_wrapper<T> > | ||||
|     : public mpl::true_ | ||||
| { | ||||
| }; | ||||
|  | ||||
| template<typename T> | ||||
| class unwrap_reference | ||||
| { | ||||
| @@ -93,12 +88,30 @@ class unwrap_reference | ||||
|     typedef T type; | ||||
| }; | ||||
|  | ||||
| template<typename T> | ||||
| class unwrap_reference<reference_wrapper<T> > | ||||
| { | ||||
|  public: | ||||
|     typedef T type; | ||||
| }; | ||||
| #  define AUX_REFERENCE_WRAPPER_METAFUNCTIONS_DEF(X) \ | ||||
| template<typename T> \ | ||||
| class is_reference_wrapper< X > \ | ||||
|     : public mpl::true_ \ | ||||
| { \ | ||||
| }; \ | ||||
| \ | ||||
| template<typename T> \ | ||||
| class unwrap_reference< X > \ | ||||
| { \ | ||||
|  public: \ | ||||
|     typedef T type; \ | ||||
| }; \ | ||||
| /**/ | ||||
|  | ||||
| AUX_REFERENCE_WRAPPER_METAFUNCTIONS_DEF(reference_wrapper<T>) | ||||
| #if !defined(BOOST_NO_CV_SPECIALIZATIONS) | ||||
| AUX_REFERENCE_WRAPPER_METAFUNCTIONS_DEF(reference_wrapper<T> const) | ||||
| AUX_REFERENCE_WRAPPER_METAFUNCTIONS_DEF(reference_wrapper<T> volatile) | ||||
| AUX_REFERENCE_WRAPPER_METAFUNCTIONS_DEF(reference_wrapper<T> const volatile) | ||||
| #endif | ||||
|  | ||||
| #  undef AUX_REFERENCE_WRAPPER_METAFUNCTIONS_DEF | ||||
|  | ||||
| # else // no partial specialization | ||||
|  | ||||
| } // namespace boost | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| //  Boost utility.hpp header file  -------------------------------------------// | ||||
|  | ||||
| //  Copyright 1999-2003 Boost.org.  Use, modification, and distribution are | ||||
| //  Copyright 1999-2003 Aleksey Gurtovoy.  Use, modification, and distribution are | ||||
| //  subject to the Boost Software License, Version 1.0.  (See accompanying file | ||||
| //  LICENSE_1_0.txt or a copy at <http://www.boost.org/LICENSE_1_0.txt>.) | ||||
|  | ||||
| @@ -11,6 +11,7 @@ | ||||
|  | ||||
| #include <boost/utility/addressof.hpp> | ||||
| #include <boost/utility/base_from_member.hpp>   | ||||
| #include <boost/utility/enable_if.hpp> | ||||
| #include <boost/checked_delete.hpp> | ||||
| #include <boost/next_prior.hpp> | ||||
| #include <boost/noncopyable.hpp> | ||||
|   | ||||
| @@ -1,15 +1,10 @@ | ||||
| // Copyright (C) 2002 Brad King (brad.king@kitware.com)  | ||||
| //                    Doug Gregor (gregod@cs.rpi.edu) | ||||
| //                    Douglas Gregor (gregod@cs.rpi.edu) | ||||
| //                    Peter Dimov | ||||
| // | ||||
| // 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. | ||||
| // Distributed under the Boost Software License, Version 1.0. (See | ||||
| // accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
|  | ||||
| // For more information, see http://www.boost.org | ||||
|  | ||||
| @@ -18,9 +13,6 @@ | ||||
|  | ||||
| # include <boost/config.hpp> | ||||
| # include <boost/detail/workaround.hpp> | ||||
| # if BOOST_WORKAROUND(BOOST_MSVC, == 1300) | ||||
| #  include <boost/type_traits/add_pointer.hpp> | ||||
| # endif | ||||
|  | ||||
| namespace boost { | ||||
|  | ||||
| @@ -28,7 +20,14 @@ namespace boost { | ||||
|  | ||||
| // VC7 strips const from nested classes unless we add indirection here | ||||
| # if BOOST_WORKAROUND(BOOST_MSVC, == 1300) | ||||
| template <typename T> typename add_pointer<T>::type | ||||
|  | ||||
| template<class T> struct _addp | ||||
| { | ||||
|     typedef T * type; | ||||
| }; | ||||
|      | ||||
| template <typename T> typename _addp<T>::type | ||||
|  | ||||
| # else | ||||
| template <typename T> T* | ||||
| # endif | ||||
| @@ -38,6 +37,22 @@ addressof(T& v) | ||||
|        &const_cast<char&>(reinterpret_cast<const volatile char &>(v))); | ||||
| } | ||||
|  | ||||
| // Borland doesn't like casting an array reference to a char reference | ||||
| // but these overloads work around the problem. | ||||
| # if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) | ||||
| template<typename T,std::size_t N> | ||||
| T (*addressof(T (&t)[N]))[N] | ||||
| { | ||||
|    return reinterpret_cast<T(*)[N]>(&t); | ||||
| } | ||||
|  | ||||
| template<typename T,std::size_t N> | ||||
| const T (*addressof(const T (&t)[N]))[N] | ||||
| { | ||||
|    return reinterpret_cast<const T(*)[N]>(&t); | ||||
| } | ||||
| # endif | ||||
|  | ||||
| } | ||||
|  | ||||
| #endif // BOOST_UTILITY_ADDRESSOF_HPP | ||||
|   | ||||
| @@ -1,15 +1,53 @@ | ||||
| //  boost utility/base_from_member.hpp header file  --------------------------// | ||||
|  | ||||
| //  Copyright 2001, 2003 Daryle Walker.  Use, modification, and distribution are | ||||
| //  subject to the Boost Software License, Version 1.0.  (See accompanying file | ||||
| //  LICENSE_1_0.txt or a copy at <http://www.boost.org/LICENSE_1_0.txt>.) | ||||
| //  Copyright 2001, 2003, 2004 Daryle Walker.  Use, modification, and | ||||
| //  distribution are subject to the Boost Software License, Version 1.0.  (See | ||||
| //  accompanying file LICENSE_1_0.txt or a copy at | ||||
| //  <http://www.boost.org/LICENSE_1_0.txt>.) | ||||
|  | ||||
| //  See <http://www.boost.org/libs/utility/> for the library's home page. | ||||
|  | ||||
| #ifndef BOOST_UTILITY_BASE_FROM_MEMBER_HPP | ||||
| #define BOOST_UTILITY_BASE_FROM_MEMBER_HPP | ||||
|  | ||||
| #include <boost/utility_fwd.hpp>  // required for parameter defaults | ||||
| #include <boost/preprocessor/arithmetic/inc.hpp> | ||||
| #include <boost/preprocessor/repetition/enum_binary_params.hpp> | ||||
| #include <boost/preprocessor/repetition/enum_params.hpp> | ||||
| #include <boost/preprocessor/repetition/repeat_from_to.hpp> | ||||
|  | ||||
|  | ||||
| //  Base-from-member arity configuration macro  ------------------------------// | ||||
|  | ||||
| // The following macro determines how many arguments will be in the largest | ||||
| // constructor template of base_from_member.  Constructor templates will be | ||||
| // generated from one argument to this maximum.  Code from other files can read | ||||
| // this number if they need to always match the exact maximum base_from_member | ||||
| // uses.  The maximum constructor length can be changed by overriding the | ||||
| // #defined constant.  Make sure to apply the override, if any, for all source | ||||
| // files during project compiling for consistency. | ||||
|  | ||||
| // Contributed by Jonathan Turkanis | ||||
|  | ||||
| #ifndef BOOST_BASE_FROM_MEMBER_MAX_ARITY | ||||
| #define BOOST_BASE_FROM_MEMBER_MAX_ARITY  10 | ||||
| #endif | ||||
|  | ||||
|  | ||||
| //  An iteration of a constructor template for base_from_member  -------------// | ||||
|  | ||||
| // A macro that should expand to: | ||||
| //     template < typename T1, ..., typename Tn > | ||||
| //     base_from_member( T1 x1, ..., Tn xn ) | ||||
| //         : member( x1, ..., xn ) | ||||
| //         {} | ||||
| // This macro should only persist within this file. | ||||
|  | ||||
| #define BOOST_PRIVATE_CTR_DEF( z, n, data )                            \ | ||||
|     template < BOOST_PP_ENUM_PARAMS(n, typename T) >                   \ | ||||
|     explicit base_from_member( BOOST_PP_ENUM_BINARY_PARAMS(n, T, x) )  \ | ||||
|         : member( BOOST_PP_ENUM_PARAMS(n, x) )                         \ | ||||
|         {}                                                             \ | ||||
|     /**/ | ||||
|  | ||||
|  | ||||
| namespace boost | ||||
| @@ -24,7 +62,7 @@ namespace boost | ||||
|  | ||||
| // Contributed by Daryle Walker | ||||
|  | ||||
| template < typename MemberType, int UniqueID > | ||||
| template < typename MemberType, int UniqueID = 0 > | ||||
| class base_from_member | ||||
| { | ||||
| protected: | ||||
| @@ -34,66 +72,16 @@ protected: | ||||
|         : member() | ||||
|         {} | ||||
|  | ||||
|     template< typename T1 > | ||||
|     explicit base_from_member( T1 x1 ) | ||||
|         : member( x1 ) | ||||
|         {} | ||||
|  | ||||
|     template< typename T1, typename T2 > | ||||
|     base_from_member( T1 x1, T2 x2 ) | ||||
|         : member( x1, x2 ) | ||||
|         {} | ||||
|  | ||||
|     template< typename T1, typename T2, typename T3 > | ||||
|     base_from_member( T1 x1, T2 x2, T3 x3 ) | ||||
|         : member( x1, x2, x3 )  | ||||
|         {} | ||||
|  | ||||
|     template< typename T1, typename T2, typename T3, typename T4 > | ||||
|     base_from_member( T1 x1, T2 x2, T3 x3, T4 x4 ) | ||||
|         : member( x1, x2, x3, x4 )  | ||||
|         {} | ||||
|  | ||||
|     template< typename T1, typename T2, typename T3, typename T4, typename T5 > | ||||
|     base_from_member( T1 x1, T2 x2, T3 x3, T4 x4, T5 x5 ) | ||||
|         : member( x1, x2, x3, x4, x5 )  | ||||
|         {} | ||||
|  | ||||
|     template< typename T1, typename T2, typename T3, typename T4, typename T5, | ||||
|      typename T6 > | ||||
|     base_from_member( T1 x1, T2 x2, T3 x3, T4 x4, T5 x5, T6 x6 ) | ||||
|         : member( x1, x2, x3, x4, x5, x6 )  | ||||
|         {} | ||||
|  | ||||
|     template< typename T1, typename T2, typename T3, typename T4, typename T5, | ||||
|      typename T6, typename T7 > | ||||
|     base_from_member( T1 x1, T2 x2, T3 x3, T4 x4, T5 x5, T6 x6, T7 x7 ) | ||||
|         : member( x1, x2, x3, x4, x5, x6, x7 )  | ||||
|         {} | ||||
|  | ||||
|     template< typename T1, typename T2, typename T3, typename T4, typename T5, | ||||
|      typename T6, typename T7, typename T8 > | ||||
|     base_from_member( T1 x1, T2 x2, T3 x3, T4 x4, T5 x5, T6 x6, T7 x7, T8 x8 ) | ||||
|         : member( x1, x2, x3, x4, x5, x6, x7, x8 )  | ||||
|         {} | ||||
|  | ||||
|     template< typename T1, typename T2, typename T3, typename T4, typename T5, | ||||
|      typename T6, typename T7, typename T8, typename T9 > | ||||
|     base_from_member( T1 x1, T2 x2, T3 x3, T4 x4, T5 x5, T6 x6, T7 x7, T8 x8, | ||||
|      T9 x9 ) | ||||
|         : member( x1, x2, x3, x4, x5, x6, x7, x8, x9 )  | ||||
|         {} | ||||
|  | ||||
|     template< typename T1, typename T2, typename T3, typename T4, typename T5, | ||||
|      typename T6, typename T7, typename T8, typename T9, typename T10 > | ||||
|     base_from_member( T1 x1, T2 x2, T3 x3, T4 x4, T5 x5, T6 x6, T7 x7, T8 x8, | ||||
|      T9 x9, T10 x10 ) | ||||
|         : member( x1, x2, x3, x4, x5, x6, x7, x8, x9, x10 )  | ||||
|         {} | ||||
|     BOOST_PP_REPEAT_FROM_TO( 1, BOOST_PP_INC(BOOST_BASE_FROM_MEMBER_MAX_ARITY), | ||||
|      BOOST_PRIVATE_CTR_DEF, _ ) | ||||
|  | ||||
| };  // boost::base_from_member | ||||
|  | ||||
| }  // namespace boost | ||||
|  | ||||
|  | ||||
| // Undo any private macros | ||||
| #undef BOOST_PRIVATE_CTR_DEF | ||||
|  | ||||
|  | ||||
| #endif  // BOOST_UTILITY_BASE_FROM_MEMBER_HPP | ||||
|   | ||||
							
								
								
									
										33
									
								
								include/boost/utility/detail/in_place_factory_prefix.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								include/boost/utility/detail/in_place_factory_prefix.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| // Copyright (C) 2003, Fernando Luis Cacciola Carballal. | ||||
| // | ||||
| // Use, modification, and distribution is subject to the Boost Software | ||||
| // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
| // See http://www.boost.org/lib/optional for documentation. | ||||
| // | ||||
| // You are welcome to contact the author at: | ||||
| //  fernando_cacciola@hotmail.com | ||||
| // | ||||
| #ifndef BOOST_UTILITY_DETAIL_INPLACE_FACTORY_PREFIX_25AGO2003_HPP | ||||
| #define BOOST_UTILITY_DETAIL_INPLACE_FACTORY_PREFIX_25AGO2003_HPP | ||||
|  | ||||
| #include <boost/config.hpp> | ||||
| #include <boost/preprocessor/repetition/enum.hpp> | ||||
| #include <boost/preprocessor/repetition/enum_params.hpp> | ||||
| #include <boost/preprocessor/repetition/enum_binary_params.hpp> | ||||
| #include <boost/preprocessor/cat.hpp> | ||||
| #include <boost/preprocessor/arithmetic/inc.hpp> | ||||
| #include <boost/preprocessor/punctuation/paren.hpp> | ||||
| #include <boost/preprocessor/facilities/empty.hpp> | ||||
|  | ||||
| #define BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_INIT(z,n,_) BOOST_PP_CAT(m_a,n) BOOST_PP_LPAREN() BOOST_PP_CAT(a,n) BOOST_PP_RPAREN() | ||||
| #define BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_DECL(z,n,_) BOOST_PP_CAT(A,n) const& BOOST_PP_CAT(m_a,n); | ||||
| #define BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_ARG(z,n,_)  BOOST_PP_CAT(m_a,n) | ||||
|  | ||||
| #define BOOST_MAX_INPLACE_FACTORY_ARITY 10 | ||||
|  | ||||
| #undef BOOST_UTILITY_DETAIL_INPLACE_FACTORY_SUFFIX_25AGO2003_HPP | ||||
|  | ||||
| #endif | ||||
|  | ||||
							
								
								
									
										23
									
								
								include/boost/utility/detail/in_place_factory_suffix.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								include/boost/utility/detail/in_place_factory_suffix.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| // Copyright (C) 2003, Fernando Luis Cacciola Carballal. | ||||
| // | ||||
| // Use, modification, and distribution is subject to the Boost Software | ||||
| // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
| // See http://www.boost.org/lib/optional for documentation. | ||||
| // | ||||
| // You are welcome to contact the author at: | ||||
| //  fernando_cacciola@hotmail.com | ||||
| // | ||||
| #ifndef BOOST_UTILITY_DETAIL_INPLACE_FACTORY_SUFFIX_25AGO2003_HPP | ||||
| #define BOOST_UTILITY_DETAIL_INPLACE_FACTORY_SUFFIX_25AGO2003_HPP | ||||
|  | ||||
| #undef BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_INIT | ||||
| #undef BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_DECL | ||||
| #undef BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_ARG | ||||
| #undef BOOST_MAX_INPLACE_FACTORY_ARITY | ||||
|  | ||||
| #undef BOOST_UTILITY_DETAIL_INPLACE_FACTORY_PREFIX_25AGO2003_HPP | ||||
|  | ||||
| #endif | ||||
|  | ||||
							
								
								
									
										86
									
								
								include/boost/utility/detail/result_of_iterate.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										86
									
								
								include/boost/utility/detail/result_of_iterate.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,86 @@ | ||||
| // Boost result_of library | ||||
|  | ||||
| //  Copyright Douglas Gregor 2004. Use, modification and | ||||
| //  distribution is subject to the Boost Software License, Version | ||||
| //  1.0. (See accompanying file LICENSE_1_0.txt or copy at | ||||
| //  http://www.boost.org/LICENSE_1_0.txt) | ||||
|  | ||||
| // For more information, see http://www.boost.org/libs/utility | ||||
| #if !defined(BOOST_PP_IS_ITERATING) | ||||
| # error Boost result_of - do not include this file! | ||||
| #endif | ||||
|  | ||||
| // CWPro8 requires an argument in a function type specialization | ||||
| #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3002)) && BOOST_PP_ITERATION() == 0 | ||||
| # define BOOST_RESULT_OF_ARGS void | ||||
| #else | ||||
| # define BOOST_RESULT_OF_ARGS BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T) | ||||
| #endif | ||||
|  | ||||
| #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) | ||||
| template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) | ||||
|          BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> | ||||
| struct result_of<F(BOOST_RESULT_OF_ARGS)> | ||||
|     : detail::result_of<F, F(BOOST_RESULT_OF_ARGS)> {}; | ||||
| #endif | ||||
|  | ||||
| namespace detail { | ||||
|  | ||||
| template<typename R,  typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) | ||||
|          BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> | ||||
| struct result_of<R (*)(BOOST_RESULT_OF_ARGS), FArgs> | ||||
| { | ||||
|   typedef R type; | ||||
| }; | ||||
|  | ||||
| template<typename R,  typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) | ||||
|          BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> | ||||
| struct result_of<R (&)(BOOST_RESULT_OF_ARGS), FArgs> | ||||
| { | ||||
|   typedef R type; | ||||
| }; | ||||
|  | ||||
| #undef BOOST_RESULT_OF_ARGS | ||||
|  | ||||
| #if BOOST_PP_ITERATION() > 1 && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) | ||||
| template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) | ||||
|          BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> | ||||
| struct result_of<R (T0::*) | ||||
|                      (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)), | ||||
|                  FArgs> | ||||
| { | ||||
|   typedef R type; | ||||
| }; | ||||
|  | ||||
| template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) | ||||
|          BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> | ||||
| struct result_of<R (T0::*) | ||||
|                      (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)) | ||||
|                      const, | ||||
|                  FArgs> | ||||
| { | ||||
|   typedef R type; | ||||
| }; | ||||
|  | ||||
| template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) | ||||
|          BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> | ||||
| struct result_of<R (T0::*) | ||||
|                      (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)) | ||||
|                      volatile, | ||||
|                  FArgs> | ||||
| { | ||||
|   typedef R type; | ||||
| }; | ||||
|  | ||||
| template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) | ||||
|          BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> | ||||
| struct result_of<R (T0::*) | ||||
|                      (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)) | ||||
|                      const volatile, | ||||
|                  FArgs> | ||||
| { | ||||
|   typedef R type; | ||||
| }; | ||||
| #endif | ||||
|  | ||||
| } | ||||
							
								
								
									
										58
									
								
								include/boost/utility/in_place_factory.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								include/boost/utility/in_place_factory.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,58 @@ | ||||
| // Copyright (C) 2003, Fernando Luis Cacciola Carballal. | ||||
| // | ||||
| // Use, modification, and distribution is subject to the Boost Software | ||||
| // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
| // See http://www.boost.org/lib/optional for documentation. | ||||
| // | ||||
| // You are welcome to contact the author at: | ||||
| //  fernando_cacciola@hotmail.com | ||||
| // | ||||
| #ifndef BOOST_UTILITY_INPLACE_FACTORY_25AGO2003_HPP | ||||
| #define BOOST_UTILITY_INPLACE_FACTORY_25AGO2003_HPP | ||||
|  | ||||
| #include <boost/utility/detail/in_place_factory_prefix.hpp> | ||||
|  | ||||
| #include <boost/type.hpp> | ||||
|  | ||||
| namespace boost { | ||||
|  | ||||
| class in_place_factory_base {} ; | ||||
|  | ||||
| #define BOOST_DEFINE_INPLACE_FACTORY_CLASS(z,n,_) \ | ||||
| template< BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n),class A) > \ | ||||
| class BOOST_PP_CAT(in_place_factory, BOOST_PP_INC(n) ) : public in_place_factory_base \ | ||||
| { \ | ||||
| public: \ | ||||
| \ | ||||
|   BOOST_PP_CAT(in_place_factory, BOOST_PP_INC(n) ) ( BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_INC(n),A,const& a) ) \ | ||||
|     : \ | ||||
|     BOOST_PP_ENUM( BOOST_PP_INC(n), BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_INIT, _ ) \ | ||||
|   {} \ | ||||
| \ | ||||
|   template<class T> \ | ||||
|   void apply ( void* address BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T) ) const \ | ||||
|   { \ | ||||
|     new ( address ) T ( BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), m_a ) ) ; \ | ||||
|   } \ | ||||
| \ | ||||
|   BOOST_PP_REPEAT( BOOST_PP_INC(n), BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_DECL, _) \ | ||||
| } ; \ | ||||
| \ | ||||
| template< BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n),class A) > \ | ||||
| BOOST_PP_CAT(in_place_factory, BOOST_PP_INC(n) ) < BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), A ) > \ | ||||
| in_place ( BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_INC(n),A, const& a) ) \ | ||||
| { \ | ||||
|   return BOOST_PP_CAT(in_place_factory, BOOST_PP_INC(n) ) < BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), A ) > \ | ||||
|            ( BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), a ) ) ; \ | ||||
| } ; \ | ||||
|  | ||||
| BOOST_PP_REPEAT( BOOST_MAX_INPLACE_FACTORY_ARITY, BOOST_DEFINE_INPLACE_FACTORY_CLASS, BOOST_PP_EMPTY() ) | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| #include <boost/utility/detail/in_place_factory_suffix.hpp> | ||||
|  | ||||
| #endif | ||||
|  | ||||
							
								
								
									
										66
									
								
								include/boost/utility/result_of.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								include/boost/utility/result_of.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,66 @@ | ||||
| // Boost result_of library | ||||
|  | ||||
| //  Copyright Douglas Gregor 2004. Use, modification and | ||||
| //  distribution is subject to the Boost Software License, Version | ||||
| //  1.0. (See accompanying file LICENSE_1_0.txt or copy at | ||||
| //  http://www.boost.org/LICENSE_1_0.txt) | ||||
|  | ||||
| // For more information, see http://www.boost.org/libs/utility | ||||
| #ifndef BOOST_RESULT_OF_HPP | ||||
| #define BOOST_RESULT_OF_HPP | ||||
|  | ||||
| #include <boost/config.hpp> | ||||
| #include <boost/type_traits/ice.hpp> | ||||
| #include <boost/type.hpp> | ||||
| #include <boost/preprocessor.hpp> | ||||
| #include <boost/detail/workaround.hpp> | ||||
| #include <boost/mpl/has_xxx.hpp> | ||||
|  | ||||
| #ifndef BOOST_RESULT_OF_NUM_ARGS | ||||
| #  define BOOST_RESULT_OF_NUM_ARGS 10 | ||||
| #endif | ||||
|  | ||||
| namespace boost { | ||||
|  | ||||
| template<typename F> struct result_of; | ||||
|  | ||||
| #if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) | ||||
| namespace detail { | ||||
|  | ||||
| BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) | ||||
|  | ||||
| template<typename F, typename FArgs, bool HasResultType> struct get_result_of; | ||||
|  | ||||
| template<typename F, typename FArgs> | ||||
| struct get_result_of<F, FArgs, true> | ||||
| { | ||||
|   typedef typename F::result_type type; | ||||
| }; | ||||
|  | ||||
| template<typename F, typename FArgs> | ||||
| struct get_result_of<F, FArgs, false> | ||||
| { | ||||
|   typedef typename F::template result<FArgs>::type type; | ||||
| }; | ||||
|  | ||||
| template<typename F> | ||||
| struct get_result_of<F, F(void), false> | ||||
| { | ||||
|   typedef void type; | ||||
| }; | ||||
|  | ||||
| template<typename F, typename FArgs> | ||||
| struct result_of : get_result_of<F, FArgs, (has_result_type<F>::value)> {}; | ||||
|  | ||||
| } // end namespace detail | ||||
|  | ||||
| #define BOOST_PP_ITERATION_PARAMS_1 (3,(0,BOOST_RESULT_OF_NUM_ARGS,<boost/utility/detail/result_of_iterate.hpp>)) | ||||
| #include BOOST_PP_ITERATE() | ||||
|  | ||||
| #else | ||||
| #  define BOOST_NO_RESULT_OF 1 | ||||
| #endif | ||||
|  | ||||
| } | ||||
|  | ||||
| #endif // BOOST_RESULT_OF_HPP | ||||
							
								
								
									
										57
									
								
								include/boost/utility/typed_in_place_factory.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								include/boost/utility/typed_in_place_factory.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,57 @@ | ||||
| // Copyright (C) 2003, Fernando Luis Cacciola Carballal. | ||||
| // | ||||
| // Use, modification, and distribution is subject to the Boost Software | ||||
| // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
| // See http://www.boost.org/lib/optional for documentation. | ||||
| // | ||||
| // You are welcome to contact the author at: | ||||
| //  fernando_cacciola@hotmail.com | ||||
| // | ||||
| #ifndef BOOST_UTILITY_TYPED_INPLACE_FACTORY_25AGO2003_HPP | ||||
| #define BOOST_UTILITY_TYPED_INPLACE_FACTORY_25AGO2003_HPP | ||||
|  | ||||
| #include <boost/utility/detail/in_place_factory_prefix.hpp> | ||||
|  | ||||
| namespace boost { | ||||
|  | ||||
| class typed_in_place_factory_base {} ; | ||||
|  | ||||
| #define BOOST_DEFINE_TYPED_INPLACE_FACTORY_CLASS(z,n,_) \ | ||||
| template< class T, BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n),class A) > \ | ||||
| class BOOST_PP_CAT(typed_in_place_factory, BOOST_PP_INC(n) ) : public typed_in_place_factory_base \ | ||||
| { \ | ||||
| public: \ | ||||
| \ | ||||
|   typedef T value_type ; \ | ||||
| \ | ||||
|   BOOST_PP_CAT(typed_in_place_factory, BOOST_PP_INC(n) ) ( BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_INC(n),A,const& a) ) \ | ||||
|     : \ | ||||
|     BOOST_PP_ENUM( BOOST_PP_INC(n), BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_INIT, _ ) \ | ||||
|   {} \ | ||||
| \ | ||||
|   void apply ( void* address ) const \ | ||||
|   { \ | ||||
|     new ( address ) T ( BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), m_a ) ) ; \ | ||||
|   } \ | ||||
| \ | ||||
|   BOOST_PP_REPEAT( BOOST_PP_INC(n), BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_DECL, _) \ | ||||
| } ; \ | ||||
| \ | ||||
| template< class T, BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n),class A) > \ | ||||
| BOOST_PP_CAT(typed_in_place_factory, BOOST_PP_INC(n) ) < T , BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), A ) > \ | ||||
| in_place ( BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_INC(n),A, const& a) ) \ | ||||
| { \ | ||||
|   return BOOST_PP_CAT(typed_in_place_factory, BOOST_PP_INC(n) ) < T, BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), A ) > \ | ||||
|            ( BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), a ) ) ; \ | ||||
| } ; \ | ||||
|  | ||||
| BOOST_PP_REPEAT( BOOST_MAX_INPLACE_FACTORY_ARITY, BOOST_DEFINE_TYPED_INPLACE_FACTORY_CLASS, BOOST_PP_EMPTY() ) | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| #include <boost/utility/detail/in_place_factory_suffix.hpp> | ||||
|  | ||||
| #endif | ||||
|  | ||||
| @@ -1,13 +1,8 @@ | ||||
| // (C) 2002, Fernando Luis Cacciola Carballal. | ||||
| // Copyright 2002, Fernando Luis Cacciola Carballal. | ||||
| // | ||||
| // This material is provided "as is", with absolutely no warranty expressed | ||||
| // or implied. Any use is at your own risk. | ||||
| // | ||||
| // Permission to use or copy this software for any purpose is hereby granted | ||||
| // without fee, provided the above notices are retained on all copies. | ||||
| // Permission to modify the code and to distribute modified code is granted, | ||||
| // provided the above notices are retained, and a notice that the code was | ||||
| // modified is included with the above copyright notice. | ||||
| // Distributed under the Boost Software License, Version 1.0. (See | ||||
| // accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
| // 21 Ago 2002 (Created) Fernando Cacciola | ||||
| // | ||||
| @@ -45,7 +40,7 @@ template<class T> | ||||
| struct select_base | ||||
| { | ||||
|   typedef typename | ||||
|     detail::if_true< ::boost::is_const<T>::value > | ||||
|     boost::detail::if_true< ::boost::is_const<T>::value > | ||||
|       ::template then< const_T_base<T>, non_const_T_base<T> >::type type ; | ||||
| } ; | ||||
|  | ||||
|   | ||||
| @@ -1,33 +0,0 @@ | ||||
| //  Boost utility_fwd.hpp header file  ---------------------------------------// | ||||
|  | ||||
| //  Copyright 2001, 2003 Boost.org.  Use, modification, and distribution are | ||||
| //  subject to the Boost Software License, Version 1.0.  (See accompanying file | ||||
| //  LICENSE_1_0.txt or a copy at <http://www.boost.org/LICENSE_1_0.txt>.) | ||||
|  | ||||
| //  See <http://www.boost.org/libs/utility/> for the library's home page. | ||||
|  | ||||
| #ifndef BOOST_UTILITY_FWD_HPP | ||||
| #define BOOST_UTILITY_FWD_HPP | ||||
|  | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|  | ||||
| //  From <boost/utility/base_from_member.hpp>  -------------------------------// | ||||
|  | ||||
| template < typename MemberType, int UniqueID = 0 > | ||||
|     class base_from_member; | ||||
|  | ||||
|  | ||||
| //  From <boost/noncopyable.hpp>  --------------------------------------------// | ||||
|  | ||||
| class noncopyable; | ||||
|  | ||||
| // Also has a few function templates | ||||
|  | ||||
|  | ||||
| }  // namespace boost | ||||
|  | ||||
|  | ||||
| #endif  // BOOST_UTILITY_FWD_HPP | ||||
							
								
								
									
										14
									
								
								index.html
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								index.html
									
									
									
									
									
								
							| @@ -7,7 +7,7 @@ | ||||
| 		<title>Boost Utility Library</title> | ||||
| 	</head> | ||||
| 	<body bgcolor="#FFFFFF"> | ||||
| 		<h1><IMG SRC="../../c++boost.gif" WIDTH="276" HEIGHT="86" align="center">Boost  | ||||
| 		<h1><IMG SRC="../../boost.png" WIDTH="276" HEIGHT="86" align="center">Boost  | ||||
| 			Utility Library</h1> | ||||
| 		<p>The Boost Utility Library isn't really a single library at all. It is just a  | ||||
| 			collection for components too small to be called libraries in their own right.</p> | ||||
| @@ -19,6 +19,7 @@ | ||||
| 				<a href="call_traits.htm">call_traits</a><br> | ||||
| 				<a href="checked_delete.html">checked_delete</a><br> | ||||
| 				<a href="compressed_pair.htm">compressed_pair</a><br> | ||||
| 				<a href="current_function.html">current_function</a><br> | ||||
| 				<a href="enable_if.html">enable_if</a><br> | ||||
|                 <a href="iterator_adaptors.htm">iterator_adaptors</a><br> | ||||
| 				<a href="operators.htm">operators</a><br> | ||||
| @@ -27,8 +28,13 @@ | ||||
|                 <a href="value_init.htm">value_init</a></p> | ||||
| 		</blockquote> | ||||
| 		<hr> | ||||
| 		<p><EFBFBD> Copyright Beman Dawes, 2001</p> | ||||
|         <p>Distributed under the Boost Software License, Version 1.0. (See  | ||||
|         accompanying file <a href="../../LICENSE_1_0.txt"> | ||||
|         LICENSE_1_0.txt</a> or copy at | ||||
|         <a href="http://www.boost.org/LICENSE_1_0.txt"> | ||||
|         www.boost.org/LICENSE_1_0.txt</a>)</p> | ||||
| 		<p>Revised  | ||||
| 			<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->01 September, 2003<!--webbot bot="Timestamp" endspan i-checksum="38582" --></p> | ||||
| 		<p> </p> | ||||
| 	</body> | ||||
| 			<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->07 November, 2006<!--webbot bot="Timestamp" endspan i-checksum="39368" --></p> | ||||
| 		</body> | ||||
| </html> | ||||
|   | ||||
| @@ -1,59 +0,0 @@ | ||||
| // (C) Copyright Jeremy Siek 2000. 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 <boost/config.hpp> | ||||
| #include <vector> | ||||
| #include <iostream> | ||||
| #include <iterator> | ||||
| #include <functional> | ||||
| #include <algorithm> | ||||
| #include <boost/iterator/indirect_iterator.hpp> | ||||
|  | ||||
| int main(int, char*[]) | ||||
| { | ||||
|   char characters[] = "abcdefg"; | ||||
|   const int N = sizeof(characters)/sizeof(char) - 1; // -1 since characters has a null char | ||||
|   char* pointers_to_chars[N];                        // at the end. | ||||
|   for (int i = 0; i < N; ++i) | ||||
|     pointers_to_chars[i] = &characters[i]; | ||||
|  | ||||
|   // Example of using indirect_iterator_generator | ||||
|    | ||||
|   boost::indirect_iterator<char**, char> | ||||
|     indirect_first(pointers_to_chars), indirect_last(pointers_to_chars + N); | ||||
|  | ||||
|   std::copy(indirect_first, indirect_last, std::ostream_iterator<char>(std::cout, ",")); | ||||
|   std::cout << std::endl; | ||||
|    | ||||
|  | ||||
|   // Example of using indirect_iterator_pair_generator | ||||
|  | ||||
|   char mutable_characters[N]; | ||||
|   char* pointers_to_mutable_chars[N]; | ||||
|   for (int j = 0; j < N; ++j) | ||||
|     pointers_to_mutable_chars[j] = &mutable_characters[j]; | ||||
|  | ||||
|   boost::indirect_iterator<char* const*> mutable_indirect_first(pointers_to_mutable_chars), | ||||
|     mutable_indirect_last(pointers_to_mutable_chars + N); | ||||
|   boost::indirect_iterator<char* const*, char const> const_indirect_first(pointers_to_chars), | ||||
|     const_indirect_last(pointers_to_chars + N); | ||||
|  | ||||
|   std::transform(const_indirect_first, const_indirect_last, | ||||
|                  mutable_indirect_first, std::bind1st(std::plus<char>(), 1)); | ||||
|  | ||||
|   std::copy(mutable_indirect_first, mutable_indirect_last, | ||||
|             std::ostream_iterator<char>(std::cout, ",")); | ||||
|   std::cout << std::endl; | ||||
|  | ||||
|    | ||||
|   // Example of using make_indirect_iterator() | ||||
|  | ||||
|   std::copy(boost::make_indirect_iterator(pointers_to_chars),  | ||||
|             boost::make_indirect_iterator(pointers_to_chars + N), | ||||
|             std::ostream_iterator<char>(std::cout, ",")); | ||||
|   std::cout << std::endl; | ||||
|    | ||||
|   return 0; | ||||
| } | ||||
| @@ -1,46 +0,0 @@ | ||||
| // (C) Copyright Jeremy Siek 2000. 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 <functional> | ||||
| #include <algorithm> | ||||
| #include <iostream> | ||||
| #include <boost/iterator/transform_iterator.hpp> | ||||
| #include <boost/pending/integer_range.hpp> | ||||
|  | ||||
| int | ||||
| main(int, char*[]) | ||||
| { | ||||
|   // This is a simple example of using the transform_iterators class to | ||||
|   // generate iterators that multiply the value returned by dereferencing | ||||
|   // the iterator. In this case we are multiplying by 2. | ||||
|   // Would be cooler to use lambda library in this example. | ||||
|  | ||||
|   int x[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; | ||||
|  | ||||
|   typedef std::binder1st< std::multiplies<int> > Function; | ||||
|    | ||||
|   typedef boost::transform_iterator<Function, int*> doubling_iterator; | ||||
|  | ||||
|   doubling_iterator i(x, std::bind1st(std::multiplies<int>(), 2)), | ||||
|     i_end(x + sizeof(x)/sizeof(int), std::bind1st(std::multiplies<int>(), 2)); | ||||
|  | ||||
|   std::cout << "multiplying the array by 2:" << std::endl; | ||||
|   while (i != i_end) | ||||
|     std::cout << *i++ << " "; | ||||
|   std::cout << std::endl; | ||||
|  | ||||
|   // Here is an example of counting from 0 to 5 using the integer_range class. | ||||
|  | ||||
|   boost::integer_range<int> r(0,5); | ||||
|  | ||||
|   std::cout << "counting to from 0 to 4:" << std::endl; | ||||
|   std::copy(r.begin(), r.end(), std::ostream_iterator<int>(std::cout, " ")); | ||||
|   std::cout << std::endl; | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
							
								
								
									
										11
									
								
								iterator_adaptors.htm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								iterator_adaptors.htm
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| <!-- Copyright David Abrahams 2004. Distributed under the Boost --> | ||||
| <!-- Software License, Version 1.0. (See accompanying --> | ||||
| <!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) --> | ||||
| <html> | ||||
| <head> | ||||
| <meta http-equiv="refresh" content="0; URL=../iterator/doc/index.html"> | ||||
| </head> | ||||
| <body> | ||||
| This documentation moved to <a href="../iterator/doc/index.html">../iterator/doc/index.html</a>. | ||||
| </body> | ||||
| </html> | ||||
| @@ -1,215 +0,0 @@ | ||||
| //  (C) Copyright David Abrahams 2002. 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 for most recent version including documentation. | ||||
|  | ||||
| //  Revision History | ||||
| //  04 Mar 2001 Patches for Intel C++ (Dave Abrahams) | ||||
| //  19 Feb 2001 Take advantage of improved iterator_traits to do more tests | ||||
| //              on MSVC. Reordered some #ifdefs for coherency. | ||||
| //              (David Abrahams) | ||||
| //  13 Feb 2001 Test new VC6 workarounds (David Abrahams) | ||||
| //  11 Feb 2001 Final fixes for Borland (David Abrahams) | ||||
| //  11 Feb 2001 Some fixes for Borland get it closer on that compiler | ||||
| //              (David Abrahams) | ||||
| //  07 Feb 2001 More comprehensive testing; factored out static tests for | ||||
| //              better reuse (David Abrahams) | ||||
| //  21 Jan 2001 Quick fix to my_iterator, which wasn't returning a | ||||
| //              reference type from operator* (David Abrahams) | ||||
| //  19 Jan 2001 Initial version with iterator operators (David Abrahams) | ||||
|  | ||||
| #include <boost/detail/iterator.hpp> | ||||
| #include <boost/type_traits/is_same.hpp> | ||||
| #include <boost/operators.hpp> | ||||
| #include <boost/static_assert.hpp> | ||||
| #include <iterator> | ||||
| #include <vector> | ||||
| #include <list> | ||||
| #include <cassert> | ||||
| #include <iostream> | ||||
|  | ||||
| // A UDT for which we can specialize std::iterator_traits<element*> on | ||||
| // compilers which don't support partial specialization. There's no | ||||
| // other reasonable way to test pointers on those compilers. | ||||
| struct element {}; | ||||
|  | ||||
| // An iterator for which we can get traits. | ||||
| struct my_iterator1 | ||||
|     : boost::forward_iterator_helper<my_iterator1, char, long, const char*, const char&> | ||||
| { | ||||
|     my_iterator1(const char* p) : m_p(p) {} | ||||
|      | ||||
|     bool operator==(const my_iterator1& rhs) const | ||||
|         { return this->m_p == rhs.m_p; } | ||||
|  | ||||
|     my_iterator1& operator++() { ++this->m_p; return *this; } | ||||
|     const char& operator*() { return *m_p; } | ||||
|  private: | ||||
|     const char* m_p; | ||||
| }; | ||||
|  | ||||
| // Used to prove that we don't require std::iterator<> in the hierarchy under | ||||
| // MSVC6, and that we can compute all the traits for a standard-conforming UDT | ||||
| // iterator. | ||||
| struct my_iterator2 | ||||
|     : boost::equality_comparable<my_iterator2 | ||||
|     , boost::incrementable<my_iterator2 | ||||
|     , boost::dereferenceable<my_iterator2,const char*> > > | ||||
| { | ||||
|     typedef char value_type; | ||||
|     typedef long difference_type; | ||||
|     typedef const char* pointer; | ||||
|     typedef const char& reference; | ||||
|     typedef std::forward_iterator_tag iterator_category; | ||||
|      | ||||
|     my_iterator2(const char* p) : m_p(p) {} | ||||
|      | ||||
|     bool operator==(const my_iterator2& rhs) const | ||||
|         { return this->m_p == rhs.m_p; } | ||||
|  | ||||
|     my_iterator2& operator++() { ++this->m_p; return *this; } | ||||
|     const char& operator*() { return *m_p; } | ||||
|  private: | ||||
|     const char* m_p; | ||||
| }; | ||||
|  | ||||
| // Used to prove that we're not overly confused by the existence of | ||||
| // std::iterator<> in the hierarchy under MSVC6 - we should find that | ||||
| // boost::detail::iterator_traits<my_iterator3>::difference_type is int. | ||||
| struct my_iterator3 : my_iterator1 | ||||
| { | ||||
|     typedef int difference_type; | ||||
|     my_iterator3(const char* p) | ||||
|         : my_iterator1(p) {} | ||||
| }; | ||||
|  | ||||
| // | ||||
| // Assertion tools.  Used instead of BOOST_STATIC_ASSERT because that | ||||
| // doesn't give us a nice stack backtrace | ||||
| // | ||||
| template <bool = false> struct assertion; | ||||
|  | ||||
| template <> struct assertion<true> | ||||
| { | ||||
|     typedef char type; | ||||
| }; | ||||
|  | ||||
| template <class T, class U> | ||||
| struct assert_same | ||||
|     : assertion<(::boost::is_same<T,U>::value)> | ||||
| { | ||||
| }; | ||||
|  | ||||
|  | ||||
| // Iterator tests | ||||
| template <class Iterator, | ||||
|     class value_type, class difference_type, class pointer, class reference, class category> | ||||
| struct non_portable_tests | ||||
| { | ||||
|     typedef typename boost::detail::iterator_traits<Iterator>::pointer test_pt; | ||||
|     typedef typename boost::detail::iterator_traits<Iterator>::reference test_rt; | ||||
|     typedef typename assert_same<test_pt, pointer>::type a1; | ||||
|     typedef typename assert_same<test_rt, reference>::type a2; | ||||
| }; | ||||
|  | ||||
| template <class Iterator, | ||||
|     class value_type, class difference_type, class pointer, class reference, class category> | ||||
| struct portable_tests | ||||
| { | ||||
|     typedef typename boost::detail::iterator_traits<Iterator>::difference_type test_dt; | ||||
|     typedef typename boost::detail::iterator_traits<Iterator>::iterator_category test_cat; | ||||
|     typedef typename assert_same<test_dt, difference_type>::type a1; | ||||
|     typedef typename assert_same<test_cat, category>::type a2; | ||||
| }; | ||||
|  | ||||
| // Test iterator_traits | ||||
| template <class Iterator, | ||||
|     class value_type, class difference_type, class pointer, class reference, class category> | ||||
| struct input_iterator_test | ||||
|     : portable_tests<Iterator,value_type,difference_type,pointer,reference,category> | ||||
| { | ||||
|     typedef typename boost::detail::iterator_traits<Iterator>::value_type test_vt; | ||||
|     typedef typename assert_same<test_vt, value_type>::type a1; | ||||
| }; | ||||
|  | ||||
| template <class Iterator, | ||||
|     class value_type, class difference_type, class pointer, class reference, class category> | ||||
| struct non_pointer_test | ||||
|     : input_iterator_test<Iterator,value_type,difference_type,pointer,reference,category> | ||||
|       , non_portable_tests<Iterator,value_type,difference_type,pointer,reference,category> | ||||
| { | ||||
| }; | ||||
|  | ||||
| template <class Iterator, | ||||
|     class value_type, class difference_type, class pointer, class reference, class category> | ||||
| struct maybe_pointer_test | ||||
|     : portable_tests<Iterator,value_type,difference_type,pointer,reference,category> | ||||
|       , non_portable_tests<Iterator,value_type,difference_type,pointer,reference,category> | ||||
| { | ||||
| }; | ||||
|  | ||||
| input_iterator_test<std::istream_iterator<int>, int, std::ptrdiff_t, int*, int&, std::input_iterator_tag> | ||||
|         istream_iterator_test; | ||||
|  | ||||
| #if defined(__BORLANDC__) && !defined(__SGI_STL_PORT) | ||||
| typedef ::std::char_traits<char>::off_type distance; | ||||
| non_pointer_test<std::ostream_iterator<int>,int, | ||||
|     distance,int*,int&,std::output_iterator_tag> ostream_iterator_test; | ||||
| #elif defined(BOOST_MSVC_STD_ITERATOR) | ||||
| non_pointer_test<std::ostream_iterator<int>, | ||||
|     int, void, int*, int&, std::output_iterator_tag> | ||||
|         ostream_iterator_test; | ||||
| #else | ||||
| non_pointer_test<std::ostream_iterator<int>, | ||||
|     void, void, void, void, std::output_iterator_tag> | ||||
|         ostream_iterator_test; | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #ifdef __KCC | ||||
|   typedef long std_list_diff_type; | ||||
| #else | ||||
|   typedef std::ptrdiff_t std_list_diff_type; | ||||
| #endif | ||||
|  | ||||
| non_pointer_test<std::list<int>::iterator, int, std_list_diff_type, int*, int&, std::bidirectional_iterator_tag> | ||||
|         list_iterator_test; | ||||
|  | ||||
| maybe_pointer_test<std::vector<int>::iterator, int, std::ptrdiff_t, int*, int&, std::random_access_iterator_tag> | ||||
|         vector_iterator_test; | ||||
|  | ||||
| maybe_pointer_test<int*, int, std::ptrdiff_t, int*, int&, std::random_access_iterator_tag> | ||||
|         int_pointer_test; | ||||
|  | ||||
| non_pointer_test<my_iterator1, char, long, const char*, const char&, std::forward_iterator_tag> | ||||
|        my_iterator1_test; | ||||
|                      | ||||
| non_pointer_test<my_iterator2, char, long, const char*, const char&, std::forward_iterator_tag> | ||||
|        my_iterator2_test; | ||||
|  | ||||
| non_pointer_test<my_iterator3, char, int, const char*, const char&, std::forward_iterator_tag> | ||||
|        my_iterator3_test; | ||||
|  | ||||
| int main() | ||||
| { | ||||
|     char chars[100]; | ||||
|     int ints[100]; | ||||
|  | ||||
|     for (int length = 3; length < 100; length += length / 3) | ||||
|     { | ||||
|         std::list<int> l(length); | ||||
|         assert(boost::detail::distance(l.begin(), l.end()) == length); | ||||
|          | ||||
|         std::vector<int> v(length); | ||||
|         assert(boost::detail::distance(v.begin(), v.end()) == length); | ||||
|  | ||||
|         assert(boost::detail::distance(&ints[0], ints + length) == length); | ||||
|         assert(boost::detail::distance(my_iterator1(chars), my_iterator1(chars + length)) == length); | ||||
|         assert(boost::detail::distance(my_iterator2(chars), my_iterator2(chars + length)) == length); | ||||
|         assert(boost::detail::distance(my_iterator3(chars), my_iterator3(chars + length)) == length); | ||||
|     } | ||||
|     return 0; | ||||
| } | ||||
| @@ -1,10 +1,9 @@ | ||||
| //  Demonstrate and test boost/operators.hpp on std::iterators  --------------// | ||||
|  | ||||
| //  (C) Copyright Jeremy Siek 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. | ||||
| //  (C) Copyright Jeremy Siek 1999. | ||||
| // Distributed under the Boost Software License, Version 1.0. (See | ||||
| // accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
|  | ||||
| //  See http://www.boost.org for most recent version including documentation. | ||||
|  | ||||
| @@ -24,7 +23,7 @@ | ||||
| #include <cstring>    // for std::strcmp | ||||
| #include <iostream>   // for std::cout (std::endl, ends, and flush indirectly) | ||||
| #include <string>     // for std::string | ||||
| #include <strstream>  // for std::ostrstream | ||||
| #include <sstream>    // for std::stringstream | ||||
|  | ||||
| # ifdef BOOST_NO_STDC_NAMESPACE | ||||
|     namespace std { using ::strcmp; } | ||||
| @@ -65,20 +64,16 @@ class test_opr_base | ||||
| protected: | ||||
|     // Test data and types | ||||
|     BOOST_STATIC_CONSTANT( std::size_t, fruit_length = 6u ); | ||||
|     BOOST_STATIC_CONSTANT( std::size_t, scratch_length = 40u ); | ||||
|  | ||||
|     typedef std::string  fruit_array_type[ fruit_length ]; | ||||
|     typedef char         scratch_array_type[ scratch_length ]; | ||||
|  | ||||
|     static  fruit_array_type    fruit; | ||||
|     static  scratch_array_type  scratch; | ||||
|  | ||||
| };  // test_opr_base | ||||
|  | ||||
| #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION | ||||
| //  A definition is required even for integral static constants | ||||
| const std::size_t test_opr_base::fruit_length; | ||||
| const std::size_t test_opr_base::scratch_length; | ||||
| #endif | ||||
|  | ||||
| template <typename T, typename R = T&, typename P = T*> | ||||
| @@ -120,9 +115,6 @@ private: | ||||
| test_opr_base::fruit_array_type | ||||
|  test_opr_base::fruit = { "apple", "orange", "pear", "peach", "grape", "plum" }; | ||||
|  | ||||
| test_opr_base::scratch_array_type | ||||
|  test_opr_base::scratch = ""; | ||||
|  | ||||
| template <typename T, typename R, typename P> | ||||
|   typename test_opr<T, R, P>::iter_type const | ||||
|  test_opr<T, R, P>::fruit_begin = test_iter<T,R,P>( fruit ); | ||||
| @@ -176,15 +168,13 @@ test_opr<T, R, P>::post_increment_test | ||||
| { | ||||
|     std::cout << "\tDoing post-increment test." << std::endl; | ||||
|  | ||||
|     std::ostrstream  oss( scratch, scratch_length ); | ||||
|     std::stringstream oss; | ||||
|     for ( iter_type i = fruit_begin ; i != fruit_end ; ) | ||||
|     { | ||||
|         oss << *i++ << ' '; | ||||
|     } | ||||
|  | ||||
|     oss << std::ends; | ||||
|     BOOST_TEST( std::strcmp(oss.str(), "apple orange pear peach grape plum ") | ||||
|      == 0 ); | ||||
|     BOOST_CHECK( oss.str() == "apple orange pear peach grape plum "); | ||||
| } | ||||
|  | ||||
| // Test post-decrement | ||||
| @@ -196,16 +186,14 @@ test_opr<T, R, P>::post_decrement_test | ||||
| { | ||||
|     std::cout << "\tDoing post-decrement test." << std::endl; | ||||
|  | ||||
|     std::ostrstream  oss( scratch, scratch_length ); | ||||
|     std::stringstream oss; | ||||
|     for ( iter_type i = fruit_end ; i != fruit_begin ; ) | ||||
|     { | ||||
|         i--; | ||||
|         oss << *i << ' '; | ||||
|     } | ||||
|  | ||||
|     oss << std::ends; | ||||
|     BOOST_TEST( std::strcmp(oss.str(), "plum grape peach pear orange apple ") | ||||
|      == 0 ); | ||||
|     BOOST_CHECK( oss.str() == "plum grape peach pear orange apple "); | ||||
| } | ||||
|  | ||||
| // Test indirect structure referral | ||||
| @@ -217,14 +205,13 @@ test_opr<T, R, P>::indirect_referral_test | ||||
| { | ||||
|     std::cout << "\tDoing indirect reference test." << std::endl; | ||||
|  | ||||
|     std::ostrstream  oss( scratch, scratch_length ); | ||||
|     std::stringstream oss; | ||||
|     for ( iter_type i = fruit_begin ; i != fruit_end ; ++i ) | ||||
|     { | ||||
|         oss << i->size() << ' '; | ||||
|     } | ||||
|  | ||||
|     oss << std::ends; | ||||
|     BOOST_TEST( std::strcmp(oss.str(), "5 6 4 5 5 4 ") == 0 ); | ||||
|     BOOST_CHECK( oss.str() == "5 6 4 5 5 4 "); | ||||
| } | ||||
|  | ||||
| // Test offset addition | ||||
| @@ -237,14 +224,13 @@ test_opr<T, R, P>::offset_addition_test | ||||
|     std::cout << "\tDoing offset addition test." << std::endl; | ||||
|  | ||||
|     std::ptrdiff_t const  two = 2; | ||||
|     std::ostrstream       oss( scratch, scratch_length ); | ||||
|     std::stringstream oss; | ||||
|     for ( iter_type i = fruit_begin ; i != fruit_end ; i = i + two ) | ||||
|     { | ||||
|         oss << *i << ' '; | ||||
|     } | ||||
|  | ||||
|     oss << std::ends; | ||||
|     BOOST_TEST( std::strcmp(oss.str(), "apple pear grape ") == 0 ); | ||||
|     BOOST_CHECK( oss.str() == "apple pear grape "); | ||||
| } | ||||
|  | ||||
| // Test offset addition, in reverse order | ||||
| @@ -257,14 +243,13 @@ test_opr<T, R, P>::reverse_offset_addition_test | ||||
|     std::cout << "\tDoing reverse offset addition test." << std::endl; | ||||
|  | ||||
|     std::ptrdiff_t const  two = 2; | ||||
|     std::ostrstream       oss( scratch, scratch_length ); | ||||
|     std::stringstream oss; | ||||
|     for ( iter_type i = fruit_begin ; i != fruit_end ; i = two + i ) | ||||
|     { | ||||
|         oss << *i << ' '; | ||||
|     } | ||||
|  | ||||
|     oss << std::ends; | ||||
|     BOOST_TEST( std::strcmp(oss.str(), "apple pear grape ") == 0 ); | ||||
|     BOOST_CHECK( oss.str() == "apple pear grape "); | ||||
| } | ||||
|  | ||||
| // Test offset subtraction | ||||
| @@ -277,7 +262,7 @@ test_opr<T, R, P>::offset_subtraction_test | ||||
|     std::cout << "\tDoing offset subtraction test." << std::endl; | ||||
|  | ||||
|     std::ptrdiff_t const  two = 2; | ||||
|     std::ostrstream       oss( scratch, scratch_length ); | ||||
|     std::stringstream oss; | ||||
|     for ( iter_type i = fruit_end ; fruit_begin < i ; ) | ||||
|     { | ||||
|         i = i - two; | ||||
| @@ -287,8 +272,7 @@ test_opr<T, R, P>::offset_subtraction_test | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     oss << std::ends; | ||||
|     BOOST_TEST( std::strcmp(oss.str(), "grape pear apple ") == 0 ); | ||||
|     BOOST_CHECK( oss.str() == "grape pear apple "); | ||||
| } | ||||
|  | ||||
| // Test comparisons | ||||
| @@ -312,10 +296,10 @@ test_opr<T, R, P>::comparison_test | ||||
|         { | ||||
|             ptrdiff_t const  j_offset = j - fruit_begin; | ||||
|  | ||||
|             BOOST_TEST( (i != j) == (i_offset != j_offset) ); | ||||
|             BOOST_TEST( (i > j) == (i_offset > j_offset) ); | ||||
|             BOOST_TEST( (i <= j) == (i_offset <= j_offset) ); | ||||
|             BOOST_TEST( (i >= j) == (i_offset >= j_offset) ); | ||||
|             BOOST_CHECK( (i != j) == (i_offset != j_offset) ); | ||||
|             BOOST_CHECK( (i > j) == (i_offset > j_offset) ); | ||||
|             BOOST_CHECK( (i <= j) == (i_offset <= j_offset) ); | ||||
|             BOOST_CHECK( (i >= j) == (i_offset >= j_offset) ); | ||||
|         } | ||||
|     } | ||||
|     cout << std::endl; | ||||
| @@ -330,13 +314,11 @@ test_opr<T, R, P>::indexing_test | ||||
| { | ||||
|     std::cout << "\tDoing indexing test." << std::endl; | ||||
|  | ||||
|     std::ostrstream  oss( scratch, scratch_length ); | ||||
|     std::stringstream oss; | ||||
|     for ( std::size_t k = 0u ; k < fruit_length ; ++k ) | ||||
|     { | ||||
|         oss << fruit_begin[ k ] << ' '; | ||||
|     } | ||||
|  | ||||
|     oss << std::ends; | ||||
|     BOOST_TEST( std::strcmp(oss.str(), "apple orange pear peach grape plum ") | ||||
|      == 0 ); | ||||
|     BOOST_CHECK( oss.str() == "apple orange pear peach grape plum "); | ||||
| } | ||||
|   | ||||
| @@ -1,10 +1,8 @@ | ||||
| //  boost class noncopyable test program  ------------------------------------// | ||||
|  | ||||
| //  (C) Copyright boost.org 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. | ||||
| //  (C) Copyright Beman Dawes 1999. Distributed under the Boost | ||||
| //  Software License, Version 1.0. (See accompanying file | ||||
| //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||||
|  | ||||
| //  See http://www.boost.org for most recent version including documentation. | ||||
|  | ||||
|   | ||||
| @@ -1,8 +1,7 @@ | ||||
| //  (C) Copyright David Abrahams 2001. 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. | ||||
| //  (C) Copyright David Abrahams 2001. | ||||
| // Distributed under the Boost Software License, Version 1.0. (See | ||||
| // accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
|  | ||||
| //  See http://www.boost.org for most recent version including documentation. | ||||
|  | ||||
| @@ -58,14 +57,22 @@ struct complement | ||||
|     struct traits | ||||
|     { | ||||
|      private: | ||||
|         // indirection through complement_traits_aux neccessary to keep MSVC happy | ||||
|         // indirection through complement_traits_aux necessary to keep MSVC happy | ||||
|         typedef complement_traits_aux<Number, size - 1> prev; | ||||
|      public: | ||||
| #if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2 | ||||
|       // GCC 4.0.2 ICEs on these C-style casts | ||||
|         BOOST_STATIC_CONSTANT(Number, max = | ||||
|                             Number((prev::max) << CHAR_BIT) | ||||
|                             + Number(UCHAR_MAX)); | ||||
|         BOOST_STATIC_CONSTANT(Number, min = Number((prev::min) << CHAR_BIT)); | ||||
| #else | ||||
|         BOOST_STATIC_CONSTANT(Number, max = | ||||
|                             Number(Number(prev::max) << CHAR_BIT) | ||||
|                             + Number(UCHAR_MAX)); | ||||
|          | ||||
|         BOOST_STATIC_CONSTANT(Number, min = Number(Number(prev::min) << CHAR_BIT)); | ||||
| #endif | ||||
|     | ||||
|     }; | ||||
| }; | ||||
|  | ||||
| @@ -222,10 +229,16 @@ void test_aux(unsigned_tag, Number*) | ||||
|         (sizeof(Number) < sizeof(boost::intmax_t)) | ||||
|         | (boost::is_same<difference_type, boost::intmax_t>::value)); | ||||
|  | ||||
| #if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2 | ||||
|     // GCC 4.0.2 ICEs on this C-style cases | ||||
|     BOOST_STATIC_ASSERT((complement_traits<Number>::max) > Number(0)); | ||||
|     BOOST_STATIC_ASSERT((complement_traits<Number>::min) == Number(0)); | ||||
| #else | ||||
|     // Force casting to Number here to work around the fact that it's an enum on MSVC | ||||
|     BOOST_STATIC_ASSERT(Number(complement_traits<Number>::max) > Number(0)); | ||||
|     BOOST_STATIC_ASSERT(Number(complement_traits<Number>::min) == Number(0)); | ||||
|      | ||||
| #endif | ||||
|  | ||||
|     const Number max = complement_traits<Number>::max; | ||||
|     const Number min = complement_traits<Number>::min; | ||||
|      | ||||
| @@ -309,10 +322,15 @@ void test_aux(signed_tag, Number*) | ||||
|         (sizeof(Number) < sizeof(boost::intmax_t)) | ||||
|         | (boost::is_same<difference_type, Number>::value)); | ||||
|  | ||||
| #if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2 | ||||
|     // GCC 4.0.2 ICEs on this cast | ||||
|     BOOST_STATIC_ASSERT((complement_traits<Number>::max) > Number(0)); | ||||
|     BOOST_STATIC_ASSERT((complement_traits<Number>::min) < Number(0)); | ||||
| #else | ||||
|     // Force casting to Number here to work around the fact that it's an enum on MSVC | ||||
|     BOOST_STATIC_ASSERT(Number(complement_traits<Number>::max) > Number(0)); | ||||
|     BOOST_STATIC_ASSERT(Number(complement_traits<Number>::min) < Number(0)); | ||||
|      | ||||
| #endif     | ||||
|     const Number max = complement_traits<Number>::max; | ||||
|     const Number min = complement_traits<Number>::min; | ||||
|      | ||||
| @@ -375,8 +393,8 @@ int main() | ||||
|     test<long>(); | ||||
|     test<unsigned long>(); | ||||
| #if defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_INTEGRAL_INT64_T) | ||||
|     test<long long>(); | ||||
|     test<unsigned long long>(); | ||||
|     test< ::boost::long_long_type>(); | ||||
|     test< ::boost::ulong_long_type>(); | ||||
| #elif defined(BOOST_MSVC) | ||||
|     // The problem of not having compile-time static class constants other than | ||||
|     // enums prevents this from working, since values get truncated. | ||||
|   | ||||
| @@ -10,7 +10,7 @@ | ||||
|   </head> | ||||
|  | ||||
|   <body text="black" bgcolor="white" link="blue" vlink="purple" alink="red"> | ||||
|     <h1><img src="../../c++boost.gif" alt="c++boost.gif (8819 bytes)" align= | ||||
|     <h1><img src="../../boost.png" alt="boost.png (6897 bytes)" align= | ||||
|     "middle" width="277" height="86">Header <cite><<a href= | ||||
|     "../../boost/operators.hpp">boost/operators.hpp</a>></cite></h1> | ||||
|  | ||||
| @@ -1955,7 +1955,7 @@ T operator+( T lhs, const T& rhs ) | ||||
|     output iterator to writing just two member functions - an appropriate | ||||
|     constructor and a copy-assignment operator. For example, here is a | ||||
|     possible implementation of <code><a href= | ||||
|     "function_output_iterator.htm">boost::function_output_iterator</a></code> | ||||
|     "../iterator/doc/function_output_iterator.html">boost::function_output_iterator</a></code> | ||||
|     adaptor:</p> | ||||
| <pre> | ||||
| template<class UnaryFunction> | ||||
| @@ -2119,10 +2119,10 @@ public: | ||||
|     backward-compatible.</p> | ||||
|     <hr> | ||||
|  | ||||
|     <p>Revised: 03 Dec 2003</p> | ||||
|     <p>Revised: 29 Oct 2004</p> | ||||
|  | ||||
|     <p>Copyright © Beman Dawes, David Abrahams, 1999-2001.</p> | ||||
|     <p>Copyright © Daniel Frey, 2002-2003.</p> | ||||
|     <p>Copyright © Daniel Frey, 2002-2004.</p> | ||||
|     <p>Use, modification, and distribution is subject to the Boost Software  | ||||
|     License, Version 1.0. (See accompanying file | ||||
|     <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy at | ||||
|   | ||||
| @@ -1,7 +1,8 @@ | ||||
| //  Demonstrate and test boost/operators.hpp  -------------------------------// | ||||
|  | ||||
| //  Copyright Beman Dawes 1999. | ||||
| //  See accompanying license for terms and conditions of use. | ||||
| //  Copyright Beman Dawes 1999.  Distributed under the Boost | ||||
| //  Software License, Version 1.0. (See accompanying file | ||||
| //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||||
|  | ||||
| //  See http://www.boost.org/libs/utility for documentation. | ||||
|  | ||||
| @@ -268,17 +269,17 @@ namespace | ||||
|     template <class X1, class Y1, class X2, class Y2> | ||||
|     void sanity_check(X1 x1, Y1 y1, X2 x2, Y2 y2) | ||||
|     { | ||||
|         BOOST_TEST( true_value(y1) == true_value(y2) ); | ||||
|         BOOST_TEST( true_value(x1) == true_value(x2) ); | ||||
|         BOOST_CHECK( true_value(y1) == true_value(y2) ); | ||||
|         BOOST_CHECK( true_value(x1) == true_value(x2) ); | ||||
|     } | ||||
|  | ||||
|     template <class X1, class Y1, class X2, class Y2> | ||||
|     void test_less_than_comparable_aux(X1 x1, Y1 y1, X2 x2, Y2 y2) | ||||
|     { | ||||
|         BOOST_TEST( (x1 < y1) == (x2 < y2) ); | ||||
|         BOOST_TEST( (x1 <= y1) == (x2 <= y2) ); | ||||
|         BOOST_TEST( (x1 >= y1) == (x2 >= y2) ); | ||||
|         BOOST_TEST( (x1 > y1) == (x2 > y2) ); | ||||
|         BOOST_CHECK( (x1 < y1) == (x2 < y2) ); | ||||
|         BOOST_CHECK( (x1 <= y1) == (x2 <= y2) ); | ||||
|         BOOST_CHECK( (x1 >= y1) == (x2 >= y2) ); | ||||
|         BOOST_CHECK( (x1 > y1) == (x2 > y2) ); | ||||
|     } | ||||
|      | ||||
|     template <class X1, class Y1, class X2, class Y2> | ||||
| @@ -292,8 +293,8 @@ namespace | ||||
|     template <class X1, class Y1, class X2, class Y2> | ||||
|     void test_equality_comparable_aux(X1 x1, Y1 y1, X2 x2, Y2 y2) | ||||
|     { | ||||
|         BOOST_TEST( (x1 == y1) == (x2 == y2) ); | ||||
|         BOOST_TEST( (x1 != y1) == (x2 != y2) ); | ||||
|         BOOST_CHECK( (x1 == y1) == (x2 == y2) ); | ||||
|         BOOST_CHECK( (x1 != y1) == (x2 != y2) ); | ||||
|     } | ||||
|      | ||||
|     template <class X1, class Y1, class X2, class Y2> | ||||
| @@ -307,7 +308,7 @@ namespace | ||||
|     template <class X1, class Y1, class X2, class Y2> | ||||
|     void test_multipliable_aux(X1 x1, Y1 y1, X2 x2, Y2 y2) | ||||
|     { | ||||
|         BOOST_TEST( (x1 * y1).value() == (x2 * y2) ); | ||||
|         BOOST_CHECK( (x1 * y1).value() == (x2 * y2) ); | ||||
|     } | ||||
|      | ||||
|     template <class X1, class Y1, class X2, class Y2> | ||||
| @@ -321,7 +322,7 @@ namespace | ||||
|   template <class A, class B> | ||||
|   void test_value_equality(A a, B b) | ||||
|   { | ||||
|       BOOST_TEST(a.value() == b); | ||||
|       BOOST_CHECK(a.value() == b); | ||||
|   } | ||||
|    | ||||
| #define TEST_OP_R(op) test_value_equality(x1 op y1, x2 op y2) | ||||
| @@ -447,16 +448,16 @@ namespace | ||||
|     void test_incrementable(X1 x1, X2 x2) | ||||
|     { | ||||
|         sanity_check( x1, x1, x2, x2 ); | ||||
|         BOOST_TEST( (x1++).value() == x2++ ); | ||||
|         BOOST_TEST( x1.value() == x2 ); | ||||
|         BOOST_CHECK( (x1++).value() == x2++ ); | ||||
|         BOOST_CHECK( x1.value() == x2 ); | ||||
|     } | ||||
|      | ||||
|     template <class X1, class X2> | ||||
|     void test_decrementable(X1 x1, X2 x2) | ||||
|     { | ||||
|         sanity_check( x1, x1, x2, x2 ); | ||||
|         BOOST_TEST( (x1--).value() == x2-- ); | ||||
|         BOOST_TEST( x1.value() == x2 ); | ||||
|         BOOST_CHECK( (x1--).value() == x2-- ); | ||||
|         BOOST_CHECK( x1.value() == x2 ); | ||||
|     } | ||||
|      | ||||
|     template <class X1, class Y1, class X2, class Y2> | ||||
| @@ -535,7 +536,7 @@ namespace | ||||
| // inherited operator templates at the moment it must, so the following | ||||
| // explicit instantiations force it to do that. | ||||
|  | ||||
| #if defined(BOOST_MSVC) && (_MSC_VER <= 1200) | ||||
| #if defined(BOOST_MSVC) && (_MSC_VER < 1300) | ||||
| template Wrapped1<int>; | ||||
| template Wrapped1<long>; | ||||
| template Wrapped1<unsigned int>; | ||||
| @@ -560,7 +561,7 @@ template Wrapped6<unsigned long, unsigned char>; | ||||
| template Wrapped6<unsigned int, unsigned char>; | ||||
| #endif | ||||
|  | ||||
| #define PRIVATE_EXPR_TEST(e, t)  BOOST_TEST( ((e), (t)) ) | ||||
| #define PRIVATE_EXPR_TEST(e, t)  BOOST_CHECK( ((e), (t)) ) | ||||
|  | ||||
| int | ||||
| test_main( int , char * [] ) | ||||
| @@ -605,22 +606,22 @@ test_main( int , char * [] ) | ||||
|     MyInt i2(2); | ||||
|     MyInt i; | ||||
|  | ||||
|     BOOST_TEST( i1.value() == 1 ); | ||||
|     BOOST_TEST( i2.value() == 2 ); | ||||
|     BOOST_TEST( i.value() == 0 ); | ||||
|     BOOST_CHECK( i1.value() == 1 ); | ||||
|     BOOST_CHECK( i2.value() == 2 ); | ||||
|     BOOST_CHECK( i.value() == 0 ); | ||||
|  | ||||
|     cout << "Created MyInt objects.\n"; | ||||
|  | ||||
|     PRIVATE_EXPR_TEST( (i = i2), (i.value() == 2) ); | ||||
|  | ||||
|     BOOST_TEST( i2 == i ); | ||||
|     BOOST_TEST( i1 != i2 ); | ||||
|     BOOST_TEST( i1 <  i2 ); | ||||
|     BOOST_TEST( i1 <= i2 ); | ||||
|     BOOST_TEST( i <= i2 ); | ||||
|     BOOST_TEST( i2 >  i1 ); | ||||
|     BOOST_TEST( i2 >= i1 ); | ||||
|     BOOST_TEST( i2 >= i ); | ||||
|     BOOST_CHECK( i2 == i ); | ||||
|     BOOST_CHECK( i1 != i2 ); | ||||
|     BOOST_CHECK( i1 <  i2 ); | ||||
|     BOOST_CHECK( i1 <= i2 ); | ||||
|     BOOST_CHECK( i <= i2 ); | ||||
|     BOOST_CHECK( i2 >  i1 ); | ||||
|     BOOST_CHECK( i2 >= i1 ); | ||||
|     BOOST_CHECK( i2 >= i ); | ||||
|  | ||||
|     PRIVATE_EXPR_TEST( (i = i1 + i2), (i.value() == 3) ); | ||||
|     PRIVATE_EXPR_TEST( (i = i + i2), (i.value() == 5) ); | ||||
| @@ -644,86 +645,86 @@ test_main( int , char * [] ) | ||||
|     MyLong j2(2); | ||||
|     MyLong j; | ||||
|  | ||||
|     BOOST_TEST( j1.value() == 1 ); | ||||
|     BOOST_TEST( j2.value() == 2 ); | ||||
|     BOOST_TEST( j.value() == 0 ); | ||||
|     BOOST_CHECK( j1.value() == 1 ); | ||||
|     BOOST_CHECK( j2.value() == 2 ); | ||||
|     BOOST_CHECK( j.value() == 0 ); | ||||
|  | ||||
|     cout << "Created MyLong objects.\n"; | ||||
|  | ||||
|     PRIVATE_EXPR_TEST( (j = j2), (j.value() == 2) ); | ||||
|      | ||||
|     BOOST_TEST( j2 == j ); | ||||
|     BOOST_TEST( 2 == j ); | ||||
|     BOOST_TEST( j2 == 2 );     | ||||
|     BOOST_TEST( j == j2 ); | ||||
|     BOOST_TEST( j1 != j2 ); | ||||
|     BOOST_TEST( j1 != 2 ); | ||||
|     BOOST_TEST( 1 != j2 ); | ||||
|     BOOST_TEST( j1 <  j2 ); | ||||
|     BOOST_TEST( 1 <  j2 ); | ||||
|     BOOST_TEST( j1 <  2 ); | ||||
|     BOOST_TEST( j1 <= j2 ); | ||||
|     BOOST_TEST( 1 <= j2 ); | ||||
|     BOOST_TEST( j1 <= j ); | ||||
|     BOOST_TEST( j <= j2 ); | ||||
|     BOOST_TEST( 2 <= j2 ); | ||||
|     BOOST_TEST( j <= 2 ); | ||||
|     BOOST_TEST( j2 >  j1 ); | ||||
|     BOOST_TEST( 2 >  j1 ); | ||||
|     BOOST_TEST( j2 >  1 ); | ||||
|     BOOST_TEST( j2 >= j1 ); | ||||
|     BOOST_TEST( 2 >= j1 ); | ||||
|     BOOST_TEST( j2 >= 1 ); | ||||
|     BOOST_TEST( j2 >= j ); | ||||
|     BOOST_TEST( 2 >= j ); | ||||
|     BOOST_TEST( j2 >= 2 ); | ||||
|     BOOST_CHECK( j2 == j ); | ||||
|     BOOST_CHECK( 2 == j ); | ||||
|     BOOST_CHECK( j2 == 2 );     | ||||
|     BOOST_CHECK( j == j2 ); | ||||
|     BOOST_CHECK( j1 != j2 ); | ||||
|     BOOST_CHECK( j1 != 2 ); | ||||
|     BOOST_CHECK( 1 != j2 ); | ||||
|     BOOST_CHECK( j1 <  j2 ); | ||||
|     BOOST_CHECK( 1 <  j2 ); | ||||
|     BOOST_CHECK( j1 <  2 ); | ||||
|     BOOST_CHECK( j1 <= j2 ); | ||||
|     BOOST_CHECK( 1 <= j2 ); | ||||
|     BOOST_CHECK( j1 <= j ); | ||||
|     BOOST_CHECK( j <= j2 ); | ||||
|     BOOST_CHECK( 2 <= j2 ); | ||||
|     BOOST_CHECK( j <= 2 ); | ||||
|     BOOST_CHECK( j2 >  j1 ); | ||||
|     BOOST_CHECK( 2 >  j1 ); | ||||
|     BOOST_CHECK( j2 >  1 ); | ||||
|     BOOST_CHECK( j2 >= j1 ); | ||||
|     BOOST_CHECK( 2 >= j1 ); | ||||
|     BOOST_CHECK( j2 >= 1 ); | ||||
|     BOOST_CHECK( j2 >= j ); | ||||
|     BOOST_CHECK( 2 >= j ); | ||||
|     BOOST_CHECK( j2 >= 2 ); | ||||
|  | ||||
|     BOOST_TEST( (j1 + 2) == 3 ); | ||||
|     BOOST_TEST( (1 + j2) == 3 ); | ||||
|     BOOST_CHECK( (j1 + 2) == 3 ); | ||||
|     BOOST_CHECK( (1 + j2) == 3 ); | ||||
|     PRIVATE_EXPR_TEST( (j = j1 + j2), (j.value() == 3) ); | ||||
|      | ||||
|     BOOST_TEST( (j + 2) == 5 ); | ||||
|     BOOST_TEST( (3 + j2) == 5 ); | ||||
|     BOOST_CHECK( (j + 2) == 5 ); | ||||
|     BOOST_CHECK( (3 + j2) == 5 ); | ||||
|     PRIVATE_EXPR_TEST( (j = j + j2), (j.value() == 5) ); | ||||
|      | ||||
|     BOOST_TEST( (j - 1) == 4 ); | ||||
|     BOOST_CHECK( (j - 1) == 4 ); | ||||
|     PRIVATE_EXPR_TEST( (j = j - j1), (j.value() == 4) ); | ||||
|      | ||||
|     BOOST_TEST( (j * 2) == 8 ); | ||||
|     BOOST_TEST( (4 * j2) == 8 ); | ||||
|     BOOST_CHECK( (j * 2) == 8 ); | ||||
|     BOOST_CHECK( (4 * j2) == 8 ); | ||||
|     PRIVATE_EXPR_TEST( (j = j * j2), (j.value() == 8) ); | ||||
|      | ||||
|     BOOST_TEST( (j / 2) == 4 ); | ||||
|     BOOST_CHECK( (j / 2) == 4 ); | ||||
|     PRIVATE_EXPR_TEST( (j = j / j2), (j.value() == 4) ); | ||||
|      | ||||
|     BOOST_TEST( (j % 3) == 1 ); | ||||
|     BOOST_CHECK( (j % 3) == 1 ); | ||||
|     PRIVATE_EXPR_TEST( (j = j % ( j - j1 )), (j.value() == 1) ); | ||||
|      | ||||
|     PRIVATE_EXPR_TEST( (j = j2 + j2), (j.value() == 4) ); | ||||
|      | ||||
|     BOOST_TEST( (1 | j2 | j) == 7 ); | ||||
|     BOOST_TEST( (j1 | 2 | j) == 7 ); | ||||
|     BOOST_TEST( (j1 | j2 | 4) == 7 ); | ||||
|     BOOST_CHECK( (1 | j2 | j) == 7 ); | ||||
|     BOOST_CHECK( (j1 | 2 | j) == 7 ); | ||||
|     BOOST_CHECK( (j1 | j2 | 4) == 7 ); | ||||
|     PRIVATE_EXPR_TEST( (j = j1 | j2 | j), (j.value() == 7) ); | ||||
|      | ||||
|     BOOST_TEST( (7 & j2) == 2 ); | ||||
|     BOOST_TEST( (j & 2) == 2 ); | ||||
|     BOOST_CHECK( (7 & j2) == 2 ); | ||||
|     BOOST_CHECK( (j & 2) == 2 ); | ||||
|     PRIVATE_EXPR_TEST( (j = j & j2), (j.value() == 2) ); | ||||
|      | ||||
|     PRIVATE_EXPR_TEST( (j = j | j1), (j.value() == 3) ); | ||||
|      | ||||
|     BOOST_TEST( (3 ^ j1) == 2 ); | ||||
|     BOOST_TEST( (j ^ 1) == 2 ); | ||||
|     BOOST_CHECK( (3 ^ j1) == 2 ); | ||||
|     BOOST_CHECK( (j ^ 1) == 2 ); | ||||
|     PRIVATE_EXPR_TEST( (j = j ^ j1), (j.value() == 2) ); | ||||
|      | ||||
|     PRIVATE_EXPR_TEST( (j = ( j + j1 ) * ( j2 | j1 )), (j.value() == 9) ); | ||||
|  | ||||
|     BOOST_TEST( (j1 << 2) == 4 ); | ||||
|     BOOST_TEST( (j2 << 1) == 4 ); | ||||
|     BOOST_CHECK( (j1 << 2) == 4 ); | ||||
|     BOOST_CHECK( (j2 << 1) == 4 ); | ||||
|     PRIVATE_EXPR_TEST( (j = j1 << j2), (j.value() == 4) ); | ||||
|  | ||||
|     BOOST_TEST( (j >> 2) == 1 ); | ||||
|     BOOST_TEST( (j2 >> 1) == 1 ); | ||||
|     BOOST_CHECK( (j >> 2) == 1 ); | ||||
|     BOOST_CHECK( (j2 >> 1) == 1 ); | ||||
|     PRIVATE_EXPR_TEST( (j = j2 >> j1), (j.value() == 1) ); | ||||
|      | ||||
|     cout << "Performed tests on MyLong objects.\n"; | ||||
| @@ -732,22 +733,22 @@ test_main( int , char * [] ) | ||||
|     MyChar k2(2); | ||||
|     MyChar k; | ||||
|  | ||||
|     BOOST_TEST( k1.value() == 1 ); | ||||
|     BOOST_TEST( k2.value() == 2 ); | ||||
|     BOOST_TEST( k.value() == 0 ); | ||||
|     BOOST_CHECK( k1.value() == 1 ); | ||||
|     BOOST_CHECK( k2.value() == 2 ); | ||||
|     BOOST_CHECK( k.value() == 0 ); | ||||
|  | ||||
|     cout << "Created MyChar objects.\n"; | ||||
|  | ||||
|     PRIVATE_EXPR_TEST( (k = k2), (k.value() == 2) ); | ||||
|  | ||||
|     BOOST_TEST( k2 == k ); | ||||
|     BOOST_TEST( k1 != k2 ); | ||||
|     BOOST_TEST( k1 <  k2 ); | ||||
|     BOOST_TEST( k1 <= k2 ); | ||||
|     BOOST_TEST( k <= k2 ); | ||||
|     BOOST_TEST( k2 >  k1 ); | ||||
|     BOOST_TEST( k2 >= k1 ); | ||||
|     BOOST_TEST( k2 >= k ); | ||||
|     BOOST_CHECK( k2 == k ); | ||||
|     BOOST_CHECK( k1 != k2 ); | ||||
|     BOOST_CHECK( k1 <  k2 ); | ||||
|     BOOST_CHECK( k1 <= k2 ); | ||||
|     BOOST_CHECK( k <= k2 ); | ||||
|     BOOST_CHECK( k2 >  k1 ); | ||||
|     BOOST_CHECK( k2 >= k1 ); | ||||
|     BOOST_CHECK( k2 >= k ); | ||||
|      | ||||
|     cout << "Performed tests on MyChar objects.\n"; | ||||
|  | ||||
| @@ -755,39 +756,39 @@ test_main( int , char * [] ) | ||||
|     MyShort l2(2); | ||||
|     MyShort l; | ||||
|  | ||||
|     BOOST_TEST( l1.value() == 1 ); | ||||
|     BOOST_TEST( l2.value() == 2 ); | ||||
|     BOOST_TEST( l.value() == 0 ); | ||||
|     BOOST_CHECK( l1.value() == 1 ); | ||||
|     BOOST_CHECK( l2.value() == 2 ); | ||||
|     BOOST_CHECK( l.value() == 0 ); | ||||
|  | ||||
|     cout << "Created MyShort objects.\n"; | ||||
|  | ||||
|     PRIVATE_EXPR_TEST( (l = l2), (l.value() == 2) ); | ||||
|      | ||||
|     BOOST_TEST( l2 == l ); | ||||
|     BOOST_TEST( 2 == l ); | ||||
|     BOOST_TEST( l2 == 2 );     | ||||
|     BOOST_TEST( l == l2 ); | ||||
|     BOOST_TEST( l1 != l2 ); | ||||
|     BOOST_TEST( l1 != 2 ); | ||||
|     BOOST_TEST( 1 != l2 ); | ||||
|     BOOST_TEST( l1 <  l2 ); | ||||
|     BOOST_TEST( 1 <  l2 ); | ||||
|     BOOST_TEST( l1 <  2 ); | ||||
|     BOOST_TEST( l1 <= l2 ); | ||||
|     BOOST_TEST( 1 <= l2 ); | ||||
|     BOOST_TEST( l1 <= l ); | ||||
|     BOOST_TEST( l <= l2 ); | ||||
|     BOOST_TEST( 2 <= l2 ); | ||||
|     BOOST_TEST( l <= 2 ); | ||||
|     BOOST_TEST( l2 >  l1 ); | ||||
|     BOOST_TEST( 2 >  l1 ); | ||||
|     BOOST_TEST( l2 >  1 ); | ||||
|     BOOST_TEST( l2 >= l1 ); | ||||
|     BOOST_TEST( 2 >= l1 ); | ||||
|     BOOST_TEST( l2 >= 1 ); | ||||
|     BOOST_TEST( l2 >= l ); | ||||
|     BOOST_TEST( 2 >= l ); | ||||
|     BOOST_TEST( l2 >= 2 ); | ||||
|     BOOST_CHECK( l2 == l ); | ||||
|     BOOST_CHECK( 2 == l ); | ||||
|     BOOST_CHECK( l2 == 2 );     | ||||
|     BOOST_CHECK( l == l2 ); | ||||
|     BOOST_CHECK( l1 != l2 ); | ||||
|     BOOST_CHECK( l1 != 2 ); | ||||
|     BOOST_CHECK( 1 != l2 ); | ||||
|     BOOST_CHECK( l1 <  l2 ); | ||||
|     BOOST_CHECK( 1 <  l2 ); | ||||
|     BOOST_CHECK( l1 <  2 ); | ||||
|     BOOST_CHECK( l1 <= l2 ); | ||||
|     BOOST_CHECK( 1 <= l2 ); | ||||
|     BOOST_CHECK( l1 <= l ); | ||||
|     BOOST_CHECK( l <= l2 ); | ||||
|     BOOST_CHECK( 2 <= l2 ); | ||||
|     BOOST_CHECK( l <= 2 ); | ||||
|     BOOST_CHECK( l2 >  l1 ); | ||||
|     BOOST_CHECK( 2 >  l1 ); | ||||
|     BOOST_CHECK( l2 >  1 ); | ||||
|     BOOST_CHECK( l2 >= l1 ); | ||||
|     BOOST_CHECK( 2 >= l1 ); | ||||
|     BOOST_CHECK( l2 >= 1 ); | ||||
|     BOOST_CHECK( l2 >= l ); | ||||
|     BOOST_CHECK( 2 >= l ); | ||||
|     BOOST_CHECK( l2 >= 2 ); | ||||
|      | ||||
|     cout << "Performed tests on MyShort objects.\n"; | ||||
|      | ||||
| @@ -797,44 +798,44 @@ test_main( int , char * [] ) | ||||
|     MyDoubleInt di; | ||||
|     MyDoubleInt tmp; | ||||
|  | ||||
|     BOOST_TEST( di1.value() == 1 ); | ||||
|     BOOST_TEST( di2.value() == 2 ); | ||||
|     BOOST_TEST( di2.value() == 2 ); | ||||
|     BOOST_TEST( di.value() == 0 ); | ||||
|     BOOST_CHECK( di1.value() == 1 ); | ||||
|     BOOST_CHECK( di2.value() == 2 ); | ||||
|     BOOST_CHECK( di2.value() == 2 ); | ||||
|     BOOST_CHECK( di.value() == 0 ); | ||||
|  | ||||
|     cout << "Created MyDoubleInt objects.\n"; | ||||
|  | ||||
|     PRIVATE_EXPR_TEST( (di = di2), (di.value() == 2) ); | ||||
|      | ||||
|     BOOST_TEST( di2 == di ); | ||||
|     BOOST_TEST( 2 == di ); | ||||
|     BOOST_TEST( di == 2 ); | ||||
|     BOOST_TEST( di1 < di2 ); | ||||
|     BOOST_TEST( 1 < di2 ); | ||||
|     BOOST_TEST( di1 <= di2 ); | ||||
|     BOOST_TEST( 1 <= di2 ); | ||||
|     BOOST_TEST( di2 > di1 ); | ||||
|     BOOST_TEST( di2 > 1 ); | ||||
|     BOOST_TEST( di2 >= di1 ); | ||||
|     BOOST_TEST( di2 >= 1 ); | ||||
|     BOOST_TEST( di1 / di2 == half ); | ||||
|     BOOST_TEST( di1 / 2 == half ); | ||||
|     BOOST_TEST( 1 / di2 == half ); | ||||
|     BOOST_CHECK( di2 == di ); | ||||
|     BOOST_CHECK( 2 == di ); | ||||
|     BOOST_CHECK( di == 2 ); | ||||
|     BOOST_CHECK( di1 < di2 ); | ||||
|     BOOST_CHECK( 1 < di2 ); | ||||
|     BOOST_CHECK( di1 <= di2 ); | ||||
|     BOOST_CHECK( 1 <= di2 ); | ||||
|     BOOST_CHECK( di2 > di1 ); | ||||
|     BOOST_CHECK( di2 > 1 ); | ||||
|     BOOST_CHECK( di2 >= di1 ); | ||||
|     BOOST_CHECK( di2 >= 1 ); | ||||
|     BOOST_CHECK( di1 / di2 == half ); | ||||
|     BOOST_CHECK( di1 / 2 == half ); | ||||
|     BOOST_CHECK( 1 / di2 == half ); | ||||
|     PRIVATE_EXPR_TEST( (tmp=di1), ((tmp/=2) == half) ); | ||||
|     PRIVATE_EXPR_TEST( (tmp=di1), ((tmp/=di2) == half) ); | ||||
|     BOOST_TEST( di1 * di2 == di2 ); | ||||
|     BOOST_TEST( di1 * 2 == di2 ); | ||||
|     BOOST_TEST( 1 * di2 == di2 ); | ||||
|     BOOST_CHECK( di1 * di2 == di2 ); | ||||
|     BOOST_CHECK( di1 * 2 == di2 ); | ||||
|     BOOST_CHECK( 1 * di2 == di2 ); | ||||
|     PRIVATE_EXPR_TEST( (tmp=di1), ((tmp*=2) == di2) ); | ||||
|     PRIVATE_EXPR_TEST( (tmp=di1), ((tmp*=di2) == di2) ); | ||||
|     BOOST_TEST( di2 - di1 == di1 ); | ||||
|     BOOST_TEST( di2 - 1 == di1 ); | ||||
|     BOOST_TEST( 2 - di1 == di1 ); | ||||
|     BOOST_CHECK( di2 - di1 == di1 ); | ||||
|     BOOST_CHECK( di2 - 1 == di1 ); | ||||
|     BOOST_CHECK( 2 - di1 == di1 ); | ||||
|     PRIVATE_EXPR_TEST( (tmp=di2), ((tmp-=1) == di1) ); | ||||
|     PRIVATE_EXPR_TEST( (tmp=di2), ((tmp-=di1) == di1) ); | ||||
|     BOOST_TEST( di1 + di1 == di2 ); | ||||
|     BOOST_TEST( di1 + 1 == di2 ); | ||||
|     BOOST_TEST( 1 + di1 == di2 ); | ||||
|     BOOST_CHECK( di1 + di1 == di2 ); | ||||
|     BOOST_CHECK( di1 + 1 == di2 ); | ||||
|     BOOST_CHECK( 1 + di1 == di2 ); | ||||
|     PRIVATE_EXPR_TEST( (tmp=di1), ((tmp+=1) == di2) ); | ||||
|     PRIVATE_EXPR_TEST( (tmp=di1), ((tmp+=di1) == di2) ); | ||||
|  | ||||
| @@ -845,48 +846,48 @@ test_main( int , char * [] ) | ||||
|     MyLongInt li; | ||||
|     MyLongInt tmp2; | ||||
|  | ||||
|     BOOST_TEST( li1.value() == 1 ); | ||||
|     BOOST_TEST( li2.value() == 2 ); | ||||
|     BOOST_TEST( li.value() == 0 ); | ||||
|     BOOST_CHECK( li1.value() == 1 ); | ||||
|     BOOST_CHECK( li2.value() == 2 ); | ||||
|     BOOST_CHECK( li.value() == 0 ); | ||||
|  | ||||
|     cout << "Created MyLongInt objects.\n"; | ||||
|  | ||||
|     PRIVATE_EXPR_TEST( (li = li2), (li.value() == 2) ); | ||||
|      | ||||
|     BOOST_TEST( li2 == li ); | ||||
|     BOOST_TEST( 2 == li ); | ||||
|     BOOST_TEST( li == 2 ); | ||||
|     BOOST_TEST( li1 < li2 ); | ||||
|     BOOST_TEST( 1 < li2 ); | ||||
|     BOOST_TEST( li1 <= li2 ); | ||||
|     BOOST_TEST( 1 <= li2 ); | ||||
|     BOOST_TEST( li2 > li1 ); | ||||
|     BOOST_TEST( li2 > 1 ); | ||||
|     BOOST_TEST( li2 >= li1 ); | ||||
|     BOOST_TEST( li2 >= 1 ); | ||||
|     BOOST_TEST( li1 % li2 == li1 ); | ||||
|     BOOST_TEST( li1 % 2 == li1 ); | ||||
|     BOOST_TEST( 1 % li2 == li1 ); | ||||
|     BOOST_CHECK( li2 == li ); | ||||
|     BOOST_CHECK( 2 == li ); | ||||
|     BOOST_CHECK( li == 2 ); | ||||
|     BOOST_CHECK( li1 < li2 ); | ||||
|     BOOST_CHECK( 1 < li2 ); | ||||
|     BOOST_CHECK( li1 <= li2 ); | ||||
|     BOOST_CHECK( 1 <= li2 ); | ||||
|     BOOST_CHECK( li2 > li1 ); | ||||
|     BOOST_CHECK( li2 > 1 ); | ||||
|     BOOST_CHECK( li2 >= li1 ); | ||||
|     BOOST_CHECK( li2 >= 1 ); | ||||
|     BOOST_CHECK( li1 % li2 == li1 ); | ||||
|     BOOST_CHECK( li1 % 2 == li1 ); | ||||
|     BOOST_CHECK( 1 % li2 == li1 ); | ||||
|     PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2%=2) == li1) ); | ||||
|     PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2%=li2) == li1) ); | ||||
|     BOOST_TEST( li1 / li2 == 0 ); | ||||
|     BOOST_TEST( li1 / 2 == 0 ); | ||||
|     BOOST_TEST( 1 / li2 == 0 ); | ||||
|     BOOST_CHECK( li1 / li2 == 0 ); | ||||
|     BOOST_CHECK( li1 / 2 == 0 ); | ||||
|     BOOST_CHECK( 1 / li2 == 0 ); | ||||
|     PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2/=2) == 0) ); | ||||
|     PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2/=li2) == 0) ); | ||||
|     BOOST_TEST( li1 * li2 == li2 ); | ||||
|     BOOST_TEST( li1 * 2 == li2 ); | ||||
|     BOOST_TEST( 1 * li2 == li2 ); | ||||
|     BOOST_CHECK( li1 * li2 == li2 ); | ||||
|     BOOST_CHECK( li1 * 2 == li2 ); | ||||
|     BOOST_CHECK( 1 * li2 == li2 ); | ||||
|     PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2*=2) == li2) ); | ||||
|     PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2*=li2) == li2) ); | ||||
|     BOOST_TEST( li2 - li1 == li1 ); | ||||
|     BOOST_TEST( li2 - 1 == li1 ); | ||||
|     BOOST_TEST( 2 - li1 == li1 ); | ||||
|     BOOST_CHECK( li2 - li1 == li1 ); | ||||
|     BOOST_CHECK( li2 - 1 == li1 ); | ||||
|     BOOST_CHECK( 2 - li1 == li1 ); | ||||
|     PRIVATE_EXPR_TEST( (tmp2=li2), ((tmp2-=1) == li1) ); | ||||
|     PRIVATE_EXPR_TEST( (tmp2=li2), ((tmp2-=li1) == li1) ); | ||||
|     BOOST_TEST( li1 + li1 == li2 ); | ||||
|     BOOST_TEST( li1 + 1 == li2 ); | ||||
|     BOOST_TEST( 1 + li1 == li2 ); | ||||
|     BOOST_CHECK( li1 + li1 == li2 ); | ||||
|     BOOST_CHECK( li1 + 1 == li2 ); | ||||
|     BOOST_CHECK( 1 + li1 == li2 ); | ||||
|     PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2+=1) == li2) ); | ||||
|     PRIVATE_EXPR_TEST( (tmp2=li1), ((tmp2+=li1) == li2) ); | ||||
|  | ||||
|   | ||||
| @@ -1,103 +0,0 @@ | ||||
| // (C) Copyright Jeremy Siek 2000. 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 <boost/config.hpp> | ||||
| #include <list> | ||||
| #include <iostream> | ||||
| #include <iterator> | ||||
| #include <algorithm> | ||||
| #include <string> | ||||
| #include <boost/iterator/transform_iterator.hpp> | ||||
|  | ||||
| struct personnel_record { | ||||
|   personnel_record(std::string n, int id) : m_name(n), m_ID(id) { } | ||||
|   std::string m_name; | ||||
|   int m_ID; | ||||
| }; | ||||
|  | ||||
| struct select_name { | ||||
|   typedef personnel_record argument_type; | ||||
|   typedef std::string const& result_type; | ||||
|   const std::string& operator()(const personnel_record& r) const { | ||||
|     return r.m_name; | ||||
|   } | ||||
|   std::string& operator()(personnel_record& r) const { | ||||
|     return r.m_name; | ||||
|   } | ||||
| }; | ||||
|  | ||||
| struct select_ID { | ||||
|   typedef personnel_record argument_type; | ||||
|   typedef int& result_type; | ||||
|   const int& operator()(const personnel_record& r) const { | ||||
|     return r.m_ID; | ||||
|   } | ||||
|   int& operator()(personnel_record& r) const { | ||||
|     return r.m_ID; | ||||
|   } | ||||
| }; | ||||
|  | ||||
| int main(int, char*[]) | ||||
| { | ||||
|   std::list<personnel_record> personnel_list; | ||||
|  | ||||
|   personnel_list.push_back(personnel_record("Barney", 13423)); | ||||
|   personnel_list.push_back(personnel_record("Fred", 12343)); | ||||
|   personnel_list.push_back(personnel_record("Wilma", 62454)); | ||||
|   personnel_list.push_back(personnel_record("Betty", 20490)); | ||||
|  | ||||
|   // Example of using transform_iterator to print out the names in the | ||||
|   // personnel list using a projection. | ||||
|  | ||||
|   boost::transform_iterator< | ||||
|       select_name | ||||
|     , std::list<personnel_record>::iterator | ||||
| #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION | ||||
|     , std::string | ||||
| #endif  | ||||
|   > | ||||
|     personnel_first(personnel_list.begin()), | ||||
|     personnel_last(personnel_list.end()); | ||||
|  | ||||
|   std::copy(personnel_first, personnel_last, | ||||
|             std::ostream_iterator<std::string>(std::cout, "\n")); | ||||
|   std::cout << std::endl; | ||||
|    | ||||
|   // Example of using transform_iterator with const_iterators to | ||||
|   // assign new ID numbers to the personnel. | ||||
|    | ||||
|   boost::transform_iterator< | ||||
|       select_ID, std::list<personnel_record>::iterator | ||||
|  > ID_first(personnel_list.begin()), | ||||
|     ID_last(personnel_list.end()); | ||||
|  | ||||
|   int new_id = 0; | ||||
|   while (ID_first != ID_last) { | ||||
|     *ID_first = new_id++; | ||||
|     ++ID_first; | ||||
|   } | ||||
|  | ||||
|     boost::transform_iterator< | ||||
|       select_ID, std::list<personnel_record>::const_iterator, int const& | ||||
|     > | ||||
|     const_ID_first(personnel_list.begin()), | ||||
|     const_ID_last(personnel_list.end()); | ||||
|  | ||||
|   std::copy(const_ID_first, const_ID_last, | ||||
|             std::ostream_iterator<int>(std::cout, " ")); | ||||
|   std::cout << std::endl; | ||||
|   std::cout << std::endl; | ||||
|  | ||||
| #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION | ||||
|   // Example of using make_const_projection_iterator() | ||||
|   // to print out the names in the personnel list again. | ||||
|   std::copy( | ||||
|       boost::make_transform_iterator<select_name>(personnel_list.begin()) | ||||
|     , boost::make_transform_iterator<select_name>(personnel_list.end()) | ||||
|     , std::ostream_iterator<std::string>(std::cout, "\n")); | ||||
| #endif | ||||
|    | ||||
|   return 0; | ||||
| } | ||||
| @@ -1,9 +1,18 @@ | ||||
| // Copyright David Abrahams and Aleksey Gurtovoy | ||||
| // 2002-2004. Distributed under the Boost Software License, Version | ||||
| // 1.0. (See accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
|  | ||||
| // compile-time test for "boost/ref.hpp" header content | ||||
| // see 'ref_test.cpp' for run-time part | ||||
|  | ||||
| #include <boost/ref.hpp> | ||||
| #include <boost/type_traits/same_traits.hpp> | ||||
| #include <boost/type_traits/is_same.hpp> | ||||
| #include <boost/type_traits/remove_const.hpp> | ||||
| #include <boost/static_assert.hpp> | ||||
| #include <boost/detail/workaround.hpp> | ||||
|  | ||||
| #include <boost/mpl/assert.hpp> | ||||
|  | ||||
| namespace { | ||||
|  | ||||
| @@ -30,13 +39,23 @@ void is_reference_wrapper_test(T) | ||||
| template< typename R, typename Ref > | ||||
| void cxx_reference_test(Ref) | ||||
| { | ||||
| #if BOOST_WORKAROUND(__BORLANDC__, < 0x600) | ||||
|     typedef typename boost::remove_const<Ref>::type ref; | ||||
|     BOOST_STATIC_ASSERT((boost::is_same<R,ref>::value)); | ||||
| #else | ||||
|     BOOST_STATIC_ASSERT((boost::is_same<R,Ref>::value)); | ||||
| #endif | ||||
| } | ||||
|  | ||||
| template< typename R, typename Ref > | ||||
| void unwrap_reference_test(Ref) | ||||
| { | ||||
| #if BOOST_WORKAROUND(__BORLANDC__, < 0x600) | ||||
|     typedef typename boost::remove_const<Ref>::type ref; | ||||
|     typedef typename boost::unwrap_reference<ref>::type type; | ||||
| #else | ||||
|     typedef typename boost::unwrap_reference<Ref>::type type; | ||||
| #endif | ||||
|     BOOST_STATIC_ASSERT((boost::is_same<R,type>::value)); | ||||
| } | ||||
|  | ||||
|   | ||||
							
								
								
									
										12
									
								
								ref_test.cpp
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								ref_test.cpp
									
									
									
									
									
								
							| @@ -1,3 +1,7 @@ | ||||
| // Copyright David Abrahams and Aleksey Gurtovoy | ||||
| // 2002-2004. Distributed under the Boost Software License, Version | ||||
| // 1.0. (See accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
|  | ||||
| // run-time test for "boost/ref.hpp" header content | ||||
| // see 'ref_ct_test.cpp' for compile-time part | ||||
| @@ -56,11 +60,11 @@ struct ref_wrapper | ||||
|  | ||||
|     static void test(T x) | ||||
|     { | ||||
|         BOOST_TEST(passthru(ref(x)) == &x); | ||||
|         BOOST_TEST(&ref(x).get() == &x); | ||||
|         BOOST_CHECK(passthru(ref(x)) == &x); | ||||
|         BOOST_CHECK(&ref(x).get() == &x); | ||||
|  | ||||
|         BOOST_TEST(cref_passthru(cref(x)) == &x); | ||||
|         BOOST_TEST(&cref(x).get() == &x); | ||||
|         BOOST_CHECK(cref_passthru(cref(x)) == &x); | ||||
|         BOOST_CHECK(&cref(x).get() == &x); | ||||
|     } | ||||
| }; | ||||
|  | ||||
|   | ||||
| @@ -1,47 +0,0 @@ | ||||
| // (C) Copyright Jeremy Siek 2000. 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 <boost/config.hpp> | ||||
| #include <iostream> | ||||
| #include <algorithm> | ||||
| #include <boost/iterator/reverse_iterator.hpp> | ||||
| #include <boost/detail/iterator.hpp> | ||||
|  | ||||
| //boost::detail::iterator_traits | ||||
| int main(int, char*[]) | ||||
| { | ||||
|   char letters_[] = "hello world!"; | ||||
|   const int N = sizeof(letters_)/sizeof(char) - 1; | ||||
|   typedef char* base_iterator; | ||||
|   base_iterator letters(letters_); | ||||
|    | ||||
|   std::cout << "original sequence of letters:\t" | ||||
|             << letters_ << std::endl; | ||||
|  | ||||
|   std::sort(letters, letters + N); | ||||
|  | ||||
|   // Use reverse_iterator_generator to print a sequence | ||||
|   // of letters in reverse order. | ||||
|    | ||||
|   boost::reverse_iterator<base_iterator> | ||||
|     reverse_letters_first(letters + N), | ||||
|     reverse_letters_last(letters); | ||||
|  | ||||
|   std::cout << "letters in descending order:\t"; | ||||
|   std::copy(reverse_letters_first, reverse_letters_last, | ||||
|             std::ostream_iterator<char>(std::cout)); | ||||
|   std::cout << std::endl; | ||||
|  | ||||
|   // Use make_reverse_iterator() to print the sequence | ||||
|   // of letters in reverse-reverse order. | ||||
|  | ||||
|   std::cout << "letters in ascending order:\t"; | ||||
|   std::copy(boost::make_reverse_iterator(reverse_letters_last), | ||||
|             boost::make_reverse_iterator(reverse_letters_first), | ||||
|             std::ostream_iterator<char>(std::cout)); | ||||
|   std::cout << std::endl; | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
| @@ -9,7 +9,7 @@ | ||||
|  | ||||
| <body bgcolor="#FFFFFF" text="#000000"> | ||||
|  | ||||
| <img src="../../c++boost.gif" alt="c++boost.gif (8819 bytes)" | ||||
| <img src="../../boost.png" alt="boost.png (6897 bytes)" | ||||
| align="center" width="277" height="86"> | ||||
|  | ||||
| <h1>Shared Container Iterator</h1> | ||||
|   | ||||
							
								
								
									
										1
									
								
								sublibs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								sublibs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| The existance of this file tells the regression reporting programs that the directory contains sub-directories which are libraries. | ||||
							
								
								
									
										43
									
								
								test/Jamfile
									
									
									
									
									
								
							
							
						
						
									
										43
									
								
								test/Jamfile
									
									
									
									
									
								
							| @@ -1,43 +0,0 @@ | ||||
| # Copyright David Abrahams 2003. 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. | ||||
|  | ||||
| # For more information, see http://www.boost.org/ | ||||
|  | ||||
|  | ||||
| # Testing Jamfile autogenerated from XML source | ||||
| subproject libs/utility/test ; | ||||
|  | ||||
| # bring in rules for testing | ||||
| import testing ; | ||||
|  | ||||
| # Make tests run by default. | ||||
| DEPENDS all : test ; | ||||
|  | ||||
| local test_monitor = <lib>@boost/libs/test/build/boost_test_exec_monitor ; | ||||
|  | ||||
| test-suite utility | ||||
|     :  | ||||
|         [ run ../iterator_traits_test.cpp ] | ||||
|         [ run ../iterators_test.cpp $(test_monitor) ] | ||||
|         [ compile-fail ../noncopyable_test.cpp ] | ||||
|         [ run ../numeric_traits_test.cpp ] | ||||
|         [ run ../operators_test.cpp $(test_monitor) ] | ||||
|         [ run ../binary_search_test.cpp $(test_monitor) ] | ||||
|         [ run ../call_traits_test.cpp : -u ] | ||||
|         [ compile-fail ../checked_delete_test.cpp ] | ||||
|         [ run ../compressed_pair_test.cpp $(test_monitor) : -u ] | ||||
|         [ run ../addressof_test.cpp $(test_monitor) ] | ||||
|         [ run ../ref_test.cpp $(test_monitor) ] | ||||
|         [ run ../enable_if_constructors.cpp $(test_monitor) ] | ||||
|         [ run ../enable_if_dummy_arg_disambiguation.cpp $(test_monitor) ] | ||||
|         [ run ../enable_if_lazy.cpp $(test_monitor) ] | ||||
|         [ run ../enable_if_lazy_test.cpp $(test_monitor) ] | ||||
|         [ run ../enable_if_member_templates.cpp $(test_monitor) ] | ||||
|         [ run ../enable_if_namespace_disambiguation.cpp $(test_monitor) ] | ||||
|         [ run ../enable_if_no_disambiguation.cpp $(test_monitor) ] | ||||
|         [ run ../enable_if_partial_specializations.cpp $(test_monitor) ] | ||||
|         [ run next_prior_test.cpp $(test_monitor) ]           | ||||
|     ; | ||||
| @@ -9,25 +9,29 @@ | ||||
| # bring in rules for testing | ||||
| import testing ; | ||||
|  | ||||
| # Please keep the tests ordered by filename | ||||
| test-suite utility | ||||
|     :  | ||||
|         [ run ../iterator_traits_test.cpp ] | ||||
|         [ run ../iterators_test.cpp ../../test/build//boost_test_exec_monitor ] | ||||
|         [ compile-fail ../noncopyable_test.cpp ] | ||||
|         [ run ../numeric_traits_test.cpp ] | ||||
|         [ run ../operators_test.cpp ../../test/build//boost_test_exec_monitor ] | ||||
|         [ run ../binary_search_test.cpp ../../test/build//boost_test_exec_monitor ] | ||||
|     : | ||||
|         [ run ../addressof_test.cpp ] | ||||
|         [ run ../assert_test.cpp ] | ||||
|         [ run ../base_from_member_test.cpp ] | ||||
|         [ run ../binary_search_test.cpp ] | ||||
|         [ run ../call_traits_test.cpp : -u ] | ||||
|         [ compile-fail ../checked_delete_test.cpp ] | ||||
|         [ run ../compressed_pair_test.cpp ../../test/build//boost_test_exec_monitor : -u ] | ||||
|         [ run ../addressof_test.cpp ../../test/build//boost_test_exec_monitor ] | ||||
|         [ run ../ref_test.cpp ../../test/build//boost_test_exec_monitor ] | ||||
|         [ run ../enable_if_constructors.cpp ../../test/build//boost_test_exec_monitor ] | ||||
|         [ run ../enable_if_dummy_arg_disambiguation.cpp ../../test/build//boost_test_exec_monitor ] | ||||
|         [ run ../enable_if_lazy.cpp ../../test/build//boost_test_exec_monitor ] | ||||
|         [ run ../enable_if_lazy_test.cpp ../../test/build//boost_test_exec_monitor ] | ||||
|         [ run ../enable_if_member_templates.cpp ../../test/build//boost_test_exec_monitor ] | ||||
|         [ run ../enable_if_namespace_disambiguation.cpp ../../test/build//boost_test_exec_monitor ] | ||||
|         [ run ../enable_if_no_disambiguation.cpp ../../test/build//boost_test_exec_monitor ] | ||||
|         [ run ../enable_if_partial_specializations.cpp ../../test/build//boost_test_exec_monitor ] | ||||
|         [ run ../compressed_pair_test.cpp ../../test/build//boost_test_exec_monitor/<link>static : -u ] | ||||
|         [ run ../current_function_test.cpp : : : <test-info>always_show_run_output ] | ||||
|         [ run ../iterators_test.cpp ../../test/build//boost_test_exec_monitor/<link>static ] | ||||
|         [ run next_prior_test.cpp ../../test/build//boost_test_exec_monitor/<link>static ] | ||||
|         [ compile-fail ../noncopyable_test.cpp ] | ||||
|         [ run ../numeric_traits_test.cpp ] | ||||
|         [ run ../operators_test.cpp ../../test/build//boost_test_exec_monitor/<link>static ] | ||||
|         [ compile ../ref_ct_test.cpp  ] | ||||
|         [ run ../ref_test.cpp ../../test/build//boost_test_exec_monitor/<link>static ] | ||||
|         [ compile result_of_test.cpp ] | ||||
|         [ run ../shared_iterator_test.cpp ] | ||||
|         [ run ../value_init_test.cpp ] | ||||
|         [ compile-fail ../value_init_test_fail1.cpp ] | ||||
|         [ compile-fail ../value_init_test_fail2.cpp ] | ||||
|         [ compile-fail ../value_init_test_fail3.cpp ] | ||||
|         [ run none_test.cpp ] | ||||
|     ; | ||||
|   | ||||
							
								
								
									
										22
									
								
								test/none_test.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								test/none_test.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| // Copyright 2007 Fernando Luis Cacciola Carballal.  Use, modification, and distribution | ||||
| // are subject to the Boost Software License, Version 1.0. (See | ||||
| // accompanying file LICENSE_1_0.txt or a copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt.) | ||||
|  | ||||
| // See http://www.boost.org/libs/utility for documentation. | ||||
|  | ||||
| // Boost test program for noost::none_t and boost::none | ||||
|  | ||||
| // Test strategy contributed by Richard Smith | ||||
|  | ||||
| #include <boost/optional/optional.hpp> // Test none.hpp is included with <optional.hpp> | ||||
|  | ||||
| // Left undefined to cause a linker error if this overload is incorrectly selected. | ||||
| void verify_no_implicit_conversion_to_int ( int i ) ; | ||||
|  | ||||
| void verify_no_implicit_conversion_to_int ( boost::optional<int> const& ) {} | ||||
|  | ||||
| int main()  | ||||
| { | ||||
|   verify_no_implicit_conversion_to_int( boost::none ); | ||||
| } | ||||
							
								
								
									
										53
									
								
								test/result_of_test.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								test/result_of_test.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,53 @@ | ||||
| // Boost result_of library | ||||
|  | ||||
| //  Copyright Douglas Gregor 2003-2004. Use, modification and | ||||
| //  distribution is subject to the Boost Software License, Version | ||||
| //  1.0. (See accompanying file LICENSE_1_0.txt or copy at | ||||
| //  http://www.boost.org/LICENSE_1_0.txt) | ||||
|  | ||||
| // For more information, see http://www.boost.org/libs/utility | ||||
| #include <boost/utility/result_of.hpp> | ||||
| #include <utility> | ||||
| #include <boost/static_assert.hpp> | ||||
| #include <boost/type_traits/is_same.hpp> | ||||
|  | ||||
| struct int_result_type { typedef int result_type; }; | ||||
|  | ||||
| struct int_result_of | ||||
| { | ||||
|   template<typename F> struct result { typedef int type; }; | ||||
| }; | ||||
|  | ||||
| struct int_result_type_and_float_result_of | ||||
| { | ||||
|   typedef int result_type; | ||||
|   template<typename F> struct result { typedef float type; }; | ||||
| }; | ||||
|  | ||||
| struct X {}; | ||||
|  | ||||
| int main() | ||||
| { | ||||
|   using namespace boost; | ||||
|  | ||||
|   typedef int (*func_ptr)(float, double); | ||||
|   typedef int (&func_ref)(float, double); | ||||
|   typedef int (X::*mem_func_ptr)(float); | ||||
|   typedef int (X::*mem_func_ptr_c)(float) const; | ||||
|   typedef int (X::*mem_func_ptr_v)(float) volatile; | ||||
|   typedef int (X::*mem_func_ptr_cv)(float) const volatile; | ||||
|  | ||||
|   BOOST_STATIC_ASSERT((is_same<result_of<int_result_type(float)>::type, int>::value)); | ||||
|   BOOST_STATIC_ASSERT((is_same<result_of<int_result_of(double)>::type, int>::value)); | ||||
|   BOOST_STATIC_ASSERT((is_same<result_of<int_result_of(void)>::type, void>::value)); | ||||
|   BOOST_STATIC_ASSERT((is_same<result_of<const int_result_of(double)>::type, int>::value)); | ||||
|   BOOST_STATIC_ASSERT((is_same<result_of<volatile int_result_of(void)>::type, void>::value)); | ||||
|   BOOST_STATIC_ASSERT((is_same<result_of<int_result_type_and_float_result_of(char)>::type, int>::value)); | ||||
|   BOOST_STATIC_ASSERT((is_same<result_of<func_ptr(char, float)>::type, int>::value)); | ||||
|   BOOST_STATIC_ASSERT((is_same<result_of<func_ref(char, float)>::type, int>::value)); | ||||
|   BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr(X,char)>::type, int>::value)); | ||||
|   BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr_c(X,char)>::type, int>::value)); | ||||
|   BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr_v(X,char)>::type, int>::value)); | ||||
|   BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr_cv(X,char)>::type, int>::value)); | ||||
|   return 0; | ||||
| } | ||||
| @@ -7,10 +7,9 @@ | ||||
| 	<body bgcolor="white" style="MARGIN-LEFT: 5%; MARGIN-RIGHT: 5%"> | ||||
| 		<table border="0" width="100%"> | ||||
| 			<tr> | ||||
| 				<td width="277"> | ||||
| 					<img src="../../c++boost.gif" alt="c++boost.gif (8819 bytes)" width="277" height="86"> | ||||
| 				<td width="277"><A href="../../index.htm"> <img src="../../boost.png" alt="boost.png (6897 bytes)" width="277" height="86" border="0"></A> | ||||
| 				</td> | ||||
| 				<td align="middle"> | ||||
| 				<td align="center"> | ||||
| 					<h1>throw_exception.hpp</h1> | ||||
| 				</td> | ||||
| 			</tr> | ||||
| @@ -52,9 +51,8 @@ template<class E> void throw_exception(E const & e) | ||||
| } | ||||
| </pre> | ||||
| 		<p><br> | ||||
| 			<small>Copyright <20> 2002 by Peter Dimov. Permission to copy, use, modify, sell and  | ||||
| 				distribute this document is granted provided this copyright notice appears in  | ||||
| 				all copies. This document is provided "as is" without express or implied  | ||||
| 				warranty, and with no claim as to its suitability for any purpose.</small></p> | ||||
| 			<small>Copyright <20> 2002 by Peter Dimov. Distributed under the Boost Software License, Version  | ||||
| 				1.0. See accompanying file <A href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</A> or  | ||||
| 				copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>.</small></p> | ||||
| 	</body> | ||||
| </html> | ||||
|   | ||||
| @@ -1,76 +0,0 @@ | ||||
| // (C) Copyright Jeremy Siek 2000. 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 <functional> | ||||
| #include <algorithm> | ||||
| #include <iostream> | ||||
| #include <boost/iterator/transform_iterator.hpp> | ||||
|  | ||||
| // What a bummer. We can't use std::binder1st with transform iterator | ||||
| // because it does not have a default constructor. Here's a version | ||||
| // that does. | ||||
|  | ||||
| namespace boost { | ||||
|  | ||||
|   template <class Operation>  | ||||
|   class binder1st | ||||
|     : public std::unary_function<typename Operation::second_argument_type, | ||||
|                                  typename Operation::result_type> { | ||||
|   protected: | ||||
|     Operation op; | ||||
|     typename Operation::first_argument_type value; | ||||
|   public: | ||||
|     binder1st() { } // this had to be added! | ||||
|     binder1st(const Operation& x, | ||||
|               const typename Operation::first_argument_type& y) | ||||
|         : op(x), value(y) {} | ||||
|     typename Operation::result_type | ||||
|     operator()(const typename Operation::second_argument_type& x) const { | ||||
|       return op(value, x);  | ||||
|     } | ||||
|   }; | ||||
|  | ||||
|   template <class Operation, class T> | ||||
|   inline binder1st<Operation> bind1st(const Operation& op, const T& x) { | ||||
|     typedef typename Operation::first_argument_type arg1_type; | ||||
|     return binder1st<Operation>(op, arg1_type(x)); | ||||
|   } | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| int | ||||
| main(int, char*[]) | ||||
| { | ||||
|   // This is a simple example of using the transform_iterators class to | ||||
|   // generate iterators that multiply the value returned by dereferencing | ||||
|   // the iterator. In this case we are multiplying by 2. | ||||
|   // Would be cooler to use lambda library in this example. | ||||
|  | ||||
|   int x[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; | ||||
|   const int N = sizeof(x)/sizeof(int); | ||||
|  | ||||
|   typedef boost::binder1st< std::multiplies<int> > Function; | ||||
|   typedef boost::transform_iterator<Function, int*> doubling_iterator; | ||||
|  | ||||
|   doubling_iterator i(x, boost::bind1st(std::multiplies<int>(), 2)), | ||||
|     i_end(x + N, boost::bind1st(std::multiplies<int>(), 2)); | ||||
|  | ||||
|   std::cout << "multiplying the array by 2:" << std::endl; | ||||
|   while (i != i_end) | ||||
|     std::cout << *i++ << " "; | ||||
|   std::cout << std::endl; | ||||
|  | ||||
|   std::cout << "adding 4 to each element in the array:" << std::endl; | ||||
|  | ||||
|   std::copy(boost::make_transform_iterator(x, boost::bind1st(std::plus<int>(), 4)), | ||||
|             boost::make_transform_iterator(x + N, boost::bind1st(std::plus<int>(), 4)), | ||||
|             std::ostream_iterator<int>(std::cout, " ")); | ||||
|   std::cout << std::endl; | ||||
|    | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
							
								
								
									
										47
									
								
								utility.htm
									
									
									
									
									
								
							
							
						
						
									
										47
									
								
								utility.htm
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ | ||||
| 		<title>Header boost/utility.hpp Documentation</title> | ||||
| 	</head> | ||||
| 	<body bgcolor="#FFFFFF" text="#000000"> | ||||
| 		<h1><img src="../../c++boost.gif" alt="c++boost.gif (8819 bytes)" align="center" WIDTH="277" HEIGHT="86">Header | ||||
| 		<h1><img src="../../boost.png" alt="boost.png (6897 bytes)" align="center" WIDTH="277" HEIGHT="86">Header | ||||
| 			<a href="../../boost/utility.hpp">boost/utility.hpp</a></h1> | ||||
| 		<p>The entire contents of the header <code><a href="../../boost/utility.hpp"><boost/utility.hpp></a></code> | ||||
| 			are in <code>namespace boost</code>.</p> | ||||
| @@ -22,6 +22,8 @@ | ||||
| 				Class <a href="#Class_noncopyable">noncopyable</a></li> | ||||
| 			<li> | ||||
| 				Function template <a href="#addressof">addressof()</a></li> | ||||
|                         <li>Class template <a href="#result_of">result_of</a></li> | ||||
|                         <li><a href="index.html">Other utilities not part of <code>utility.hpp</code></a></li> | ||||
| 		</ul> | ||||
| 		<h2> | ||||
| 			Function templates <a name="checked_delete">checked_delete</a>() and  | ||||
| @@ -136,11 +138,52 @@ void f() { | ||||
|   // nonaddressable* xpe = &x; /* error */ | ||||
| }</pre> | ||||
| 		</blockquote> | ||||
|                 <h2><a name="result_of">Class template | ||||
|                 result_of</a></h2> <p>The class template | ||||
|                 <code>result_of</code> helps determine the type of a | ||||
|                 call expression. Given an lvalue <code>f</code> of | ||||
|                 type <code>F</code> and lvalues <code>t1</code>, | ||||
|                 <code>t2</code>, ..., <code>t<em>N</em></code> of | ||||
|                 types <code>T1</code>, <code>T2</code>, ..., | ||||
|                 <code>T<em>N</em></code>, respectively, the type | ||||
|                 <code>result_of<F(T1, T2, ..., | ||||
|                 T<em>N</em>)>::type</code> defines the result type | ||||
|                 of the expression <code>f(t1, t2, | ||||
|                 ...,t<em>N</em>)</code>. The implementation permits | ||||
|                 the type <code>F</code> to be a function pointer, | ||||
|                 function reference, member function pointer, or class | ||||
|                 type. When <code>F</code> is a class type with a | ||||
|                 member type <code>result_type</code>, | ||||
|                 <code>result_of<F(T1, T2, ..., | ||||
|                 T<em>N</em>)></code> is | ||||
|                 <code>F::result_type</code>. Otherwise, | ||||
|                 <code>result_of<F(T1, T2, ..., | ||||
|                 T<em>N</em>)></code> is <code>F::result<F(T1, | ||||
|                 T2, ..., T<em>N</em>)>::type</code> when | ||||
|                 <code><em>N</em> > 0</code> or <code>void</code> | ||||
|                 when <code><em>N</em> = 0</code>. For additional | ||||
|                 information about <code>result_of</code>, see the | ||||
|                 current draft of the C++ Library TR, <a | ||||
|                 href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2004/n1647.pdf">N1647</a>, | ||||
|                 or the <code>result_of</code> <a | ||||
|                 href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1454.html">proposal</a>.</p> | ||||
|  | ||||
|                 <p>Class template <code>result_of</code> resides in | ||||
|                 the header <code><<a | ||||
|                 href="../../boost/utility/result_of.hpp">boost/utility/result_of.hpp</a>></code>. By | ||||
|                 default, <em>N</em> may be any value between 0 and | ||||
|                 10. To change the upper limit, define the macro | ||||
|                 <code>BOOST_RESULT_OF_NUM_ARGS</code> to the maximum | ||||
|                 value for <em>N</em>.</p> | ||||
|  | ||||
|                 <a name="BOOST_NO_RESULT_OF"></a> | ||||
|                 <p>This implementation of <code>result_of</code> requires class template partial specialization, the ability to parse function types properly, and support for SFINAE. If <code>result_of</code> is not supported by your compiler, including the header <code>boost/utility/result_of.hpp</code> will define the macro <code>BOOST_NO_RESULT_OF</code>. Contributed by Doug Gregor.</p> | ||||
|  | ||||
| 		<h2>Class templates for the Base-from-Member Idiom</h2> | ||||
| 		<p>See <a href="base_from_member.html">separate documentation</a>.</p> | ||||
| 		<hr> | ||||
| 		<p>Revised  <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan | ||||
| -->23 December, 2003<!--webbot bot="Timestamp" endspan i-checksum="38582" | ||||
| -->02 May, 2004<!--webbot bot="Timestamp" endspan i-checksum="38582" | ||||
| --> | ||||
| 		</p> | ||||
| 		<p>© Copyright boost.org 1999-2003. Permission to copy, use, modify, sell and distribute  | ||||
|   | ||||
| @@ -8,15 +8,15 @@ | ||||
| </head> | ||||
|   <body vlink="#800080" link="#0000ff" text="#000000" bgcolor="#ffffff"> | ||||
|                     | ||||
| <h2><img src="../../c++boost.gif" width="276" height="86"> | ||||
| <h2><img src="../../boost.png" width="276" height="86"> | ||||
|          Header <<a href="../../boost/utility/value_init.hpp">boost/utility/value_init.hpp</a>> | ||||
|      </h2> | ||||
|                     | ||||
| <h2>Contents</h2> | ||||
|                     | ||||
| <dl> | ||||
|   <dt><a href="#intro">Rationale</a></dt> | ||||
|   <dt><a href="#rationale">Introduction</a></dt> | ||||
|   <dt><a href="#rationale">Rationale</a></dt> | ||||
|   <dt><a href="#intro">Introduction</a></dt> | ||||
| </dl> | ||||
|                     | ||||
| <ul> | ||||
| @@ -49,7 +49,7 @@ a solution   with consistent syntax for value   initialization of scalar, | ||||
| union and class   types. <br> | ||||
|   </p> | ||||
|          | ||||
| <h2><a name="into"></a>Introduction</h2> | ||||
| <h2><a name="intro"></a>Introduction</h2> | ||||
|       | ||||
| <p>The C++ standard [<a href="#references">1</a>] contains the definitions  | ||||
|     of <code>zero-initialization</code> and <code>default-initialization</code>. | ||||
| @@ -131,7 +131,7 @@ data member:</p> | ||||
|                     | ||||
| <h2><a name="val_init"><code>template class value_initialized<T></code></a></h2> | ||||
|                     | ||||
| <pre>namespace boost {<br><br>template<class T><br>class value_initialized<br>{<br>  public :<br>    value_initialized() : x() {}<br>    operator T&() const { return x ; }<br>    T& data() const { return x ; }<br><br>  private :<br>    <i>impll-defined</i> x ;<br>} ;<br><br>template<class T><br>T const& get ( value_initialized<T> const& x )<br>{<br>  return x.data() ;<br>}<br><br>template<class T><br>T& get ( value_initialized<T>& x )<br>{<br>  return x.data() ;<br>}<br><br>} // namespace boost<br></pre> | ||||
| <pre>namespace boost {<br><br>template<class T><br>class value_initialized<br>{<br>  public :<br>    value_initialized() : x() {}<br>    operator T&() const { return x ; }<br>    T& data() const { return x ; }<br><br>  private :<br>    <i>unspecified</i> x ;<br>} ;<br><br>template<class T><br>T const& get ( value_initialized<T> const& x )<br>{<br>  return x.data() ;<br>}<br><br>template<class T><br>T& get ( value_initialized<T>& x )<br>{<br>  return x.data() ;<br>}<br><br>} // namespace boost<br></pre> | ||||
|                      | ||||
| <p>An object of this template class is a <code>T</code>-wrapper convertible  | ||||
|     to <code>'T&'</code> whose wrapped object (data member of type <code>T</code>)  | ||||
|   | ||||
| @@ -1,13 +1,8 @@ | ||||
| // (C) 2002, Fernando Luis Cacciola Carballal. | ||||
| // | ||||
| // This material is provided "as is", with absolutely no warranty expressed | ||||
| // or implied. Any use is at your own risk. | ||||
| // | ||||
| // Permission to use or copy this software for any purpose is hereby granted | ||||
| // without fee, provided the above notices are retained on all copies. | ||||
| // Permission to modify the code and to distribute modified code is granted, | ||||
| // provided the above notices are retained, and a notice that the code was | ||||
| // modified is included with the above copyright notice. | ||||
| // Distributed under the Boost Software License, Version 1.0. (See | ||||
| // accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
| // Test program for "boost/utility/value_init.hpp" | ||||
| // | ||||
| @@ -22,8 +17,7 @@ | ||||
| #pragma hdrstop | ||||
| #endif | ||||
|  | ||||
| #define BOOST_INCLUDE_MAIN | ||||
| #include "boost/test/test_tools.hpp" | ||||
| #include "boost/test/minimal.hpp" | ||||
|  | ||||
| // | ||||
| // Sample POD type | ||||
| @@ -70,34 +64,28 @@ template<class T> | ||||
| void test ( T const& y, T const& z ) | ||||
| { | ||||
|   boost::value_initialized<T> x ; | ||||
|   BOOST_TEST ( y == x ) ; | ||||
|   BOOST_TEST ( y == get(x) ) ; | ||||
|   BOOST_CHECK ( y == x ) ; | ||||
|   BOOST_CHECK ( y == boost::get(x) ) ; | ||||
|   static_cast<T&>(x) = z ; | ||||
|   get(x) = z ; | ||||
|   BOOST_TEST ( x == z ) ; | ||||
|   boost::get(x) = z ; | ||||
|   BOOST_CHECK ( x == z ) ; | ||||
|  | ||||
|   boost::value_initialized<T> const x_c ; | ||||
|   BOOST_TEST ( y == x_c ) ; | ||||
|   BOOST_TEST ( y == get(x_c) ) ; | ||||
|   static_cast<T&>(x_c) = z ; | ||||
|   BOOST_TEST ( x_c == z ) ; | ||||
|   #ifdef PRODUCE_ERROR_1 | ||||
|   get(x_c) = z ; // this should produce an ERROR | ||||
|   #endif | ||||
|   BOOST_CHECK ( y == x_c ) ; | ||||
|   BOOST_CHECK ( y == boost::get(x_c) ) ; | ||||
|   T& x_c_ref = x_c ; | ||||
|   x_c_ref = z ; | ||||
|   BOOST_CHECK ( x_c == z ) ; | ||||
|  | ||||
| #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) | ||||
|   boost::value_initialized<T const> cx ; | ||||
|   BOOST_TEST ( y == cx ) ; | ||||
|   BOOST_TEST ( y == get(cx) ) ; | ||||
|   #ifdef PRODUCE_ERROR_2 | ||||
|   get(cx) = z ; // this should produce an ERROR | ||||
|   #endif | ||||
|   BOOST_CHECK ( y == cx ) ; | ||||
|   BOOST_CHECK ( y == boost::get(cx) ) ; | ||||
|  | ||||
|   boost::value_initialized<T const> const cx_c ; | ||||
|   BOOST_TEST ( y == cx_c ) ; | ||||
|   BOOST_TEST ( y == get(cx_c) ) ; | ||||
|   #ifdef PRODUCE_ERROR_3 | ||||
|   get(cx_c) = z ; // this should produce an ERROR | ||||
|   #endif | ||||
|   BOOST_CHECK ( y == cx_c ) ; | ||||
|   BOOST_CHECK ( y == boost::get(cx_c) ) ; | ||||
| #endif | ||||
| } | ||||
|  | ||||
| int test_main(int, char **) | ||||
|   | ||||
							
								
								
									
										37
									
								
								value_init_test_fail1.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								value_init_test_fail1.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| // (C) 2002, Fernando Luis Cacciola Carballal. | ||||
| // | ||||
| // Distributed under the Boost Software License, Version 1.0. (See | ||||
| // accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
| // Test program for "boost/utility/value_init.hpp" | ||||
| // | ||||
| // Initial: 21 Agu 2002 | ||||
|  | ||||
| #include <iostream> | ||||
| #include <string> | ||||
|  | ||||
| #include "boost/utility/value_init.hpp" | ||||
|  | ||||
| #ifdef __BORLANDC__ | ||||
| #pragma hdrstop | ||||
| #endif | ||||
|  | ||||
| #include "boost/test/minimal.hpp" | ||||
|  | ||||
| int test_main(int, char **) | ||||
| { | ||||
|   boost::value_initialized<int> const x_c ; | ||||
|  | ||||
|   get(x_c) = 1234 ; // this should produce an ERROR | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| unsigned int expected_failures = 0; | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
							
								
								
									
										36
									
								
								value_init_test_fail2.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								value_init_test_fail2.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| // (C) 2002, Fernando Luis Cacciola Carballal. | ||||
| // | ||||
| // Distributed under the Boost Software License, Version 1.0. (See | ||||
| // accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
| // Test program for "boost/utility/value_init.hpp" | ||||
| // | ||||
| // Initial: 21 Agu 2002 | ||||
|  | ||||
| #include <iostream> | ||||
| #include <string> | ||||
|  | ||||
| #include "boost/utility/value_init.hpp" | ||||
|  | ||||
| #ifdef __BORLANDC__ | ||||
| #pragma hdrstop | ||||
| #endif | ||||
|  | ||||
| #include "boost/test/minimal.hpp" | ||||
|  | ||||
| int test_main(int, char **) | ||||
| { | ||||
|   boost::value_initialized<int const> cx ; | ||||
|  | ||||
|   get(cx) = 1234 ; // this should produce an ERROR | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| unsigned int expected_failures = 0; | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
							
								
								
									
										37
									
								
								value_init_test_fail3.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								value_init_test_fail3.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| // (C) 2002, Fernando Luis Cacciola Carballal. | ||||
| // | ||||
| // Distributed under the Boost Software License, Version 1.0. (See | ||||
| // accompanying file LICENSE_1_0.txt or copy at | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
| // Test program for "boost/utility/value_init.hpp" | ||||
| // | ||||
| // Initial: 21 Agu 2002 | ||||
|  | ||||
| #include <iostream> | ||||
| #include <string> | ||||
|  | ||||
| #include "boost/utility/value_init.hpp" | ||||
|  | ||||
| #ifdef __BORLANDC__ | ||||
| #pragma hdrstop | ||||
| #endif | ||||
|  | ||||
| #include "boost/test/minimal.hpp" | ||||
|  | ||||
| int test_main(int, char **) | ||||
| { | ||||
|   boost::value_initialized<int const> const cx_c ; | ||||
|  | ||||
|   get(cx_c) = 1234 ; // this should produce an ERROR | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| unsigned int expected_failures = 0; | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user