include/nana/Qstl.h

Go to the documentation of this file.
00001 /*
00002  * Qstl.h - support for quantifers when using STL under C++.
00003  * 
00004  * Copyright (c) 1997 Phil Maker
00005  * All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  * 1. Redistributions of source code must retain the above copyright
00011  *    notice, this list of conditions and the following disclaimer.
00012  * 2. Redistributions in binary form must reproduce the above copyright
00013  *    notice, this list of conditions and the following disclaimer in the
00014  *    documentation and/or other materials provided with the distribution.
00015  *
00016  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
00017  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00019  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
00020  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00021  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00022  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00023  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00024  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00025  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00026  * SUCH DAMAGE.
00027  *
00028  * Id: Qstl.h,v 1.1.1.1 1997/11/23 11:45:50 pjm Exp 
00029  */
00030 
00031 #ifndef _Qstl_h_
00032 #define _Qstl_h_ 1
00033 
00034 #ifndef __cplusplus
00035 This header file should only ever be included by a C++ program!
00036 Better luck next time. 
00037 #error 10
00038 #endif
00039 
00040 #include <Q.h>
00041 
00042 /*
00043  * Warning: You might be tempted to remove the typedef from the
00044  *   following code but it seems to be required by g++. Scoping
00045  *   of type declarations allows us to us a fixed name.
00046  */
00047 
00048 #define AO(name,container,predicate) \
00049   ({ \
00050     typedef typeof(container) _Qstl_type_; \
00051     A(_Qstl_type_::iterator name = container.begin(), \
00052         name != container.end(), \
00053         ++name, \
00054         predicate); \
00055   })
00056 
00057 #define EO(name,container,predicate) \
00058   ({ \
00059     typedef typeof(container) _Qstl_type_; \
00060     E(_Qstl_type_::iterator name = container.begin(), \
00061         name != container.end(), \
00062         ++name, \
00063         predicate); \
00064   })
00065 
00066 #define E1O(name,container,predicate) \
00067   ({ \
00068     typedef typeof(container) _Qstl_type_; \
00069     E1(_Qstl_type_::iterator name = container.begin(), \
00070         name != container.end(), \
00071         ++name, \
00072         predicate); \
00073   })
00074 
00075 #define CO(name,container,predicate) \
00076   ({ \
00077     typedef typeof(container) _Qstl_type_; \
00078     C(_Qstl_type_::iterator name = container.begin(), \
00079         name != container.end(), \
00080         ++name, \
00081         predicate); \
00082   })
00083 
00084 #define SO(name,container,exprn) \
00085   ({ \
00086     typedef typeof(container) _Qstl_type_; \
00087     S(_Qstl_type_::iterator name = container.begin(), \
00088         name != container.end(), \
00089         ++name, \
00090         exprn); \
00091   })
00092 
00093 #define PO(name,container,exprn) \
00094   ({ \
00095     typedef typeof(container) _Qstl_type_; \
00096     P(_Qstl_type_::iterator name = container.begin(), \
00097         name != container.end(), \
00098         ++name, \
00099         exprn); \
00100   })
00101 
00102 #endif

Generated on Sun Aug 21 04:18:13 2005 for Udanax-Green by doxygen1.3.4