const bool traps = __glibcxx_integral_traps; static const bool tinyness_before = false; static const float_round_style round_style = round_toward_zero; }; /// numeric_limits specialization. template<> struct numeric_limits { static const bool is_specialized = true; static long long min() throw() { return -__LONG_LONG_MAX__ - 1; } static long long max() throw() { return __LONG_LONG_MAX__; } static const int digits = __glibcxx_digits (long long); static const int digits10 = __glibcxx_digits10 (long long); static const bool is_signed = true; static const bool is_integer = true; static const bool is_exact = true; static const int radix = 2; static long long epsilon() throw() { return 0; } static long long round_error() throw() { return 0; } static const int min_exponent = 0; static const int min_exponent10 = 0; static const int max_exponent = 0; static const int max_exponent10 = 0; static const bool has_infinity = false; static const bool has_quiet_NaN = false; static const bool has_signaling_NaN = false; static const float_denorm_style has_denorm = denorm_absent; static const bool has_denorm_loss = false; static long long infinity() throw() { return static_cast(0); } static long long quiet_NaN() throw() { return static_cast(0); } static long long signaling_NaN() throw() { return static_cast(0); } static long long denorm_min() throw() { return static_cast(0); } static const bool is_iec559 = false; static const bool is_bounded = true; static const bool is_modulo = true; static const bool traps = __glibcxx_integral_traps; static const bool tinyness_before = false; static const float_round_style round_style = round_toward_zero; }; /// numeric_limits specialization. template<> struct numeric_limits { static const bool is_specialized = true; static unsigned long long min() throw() { return 0; } static unsigned long long max() throw() { return __LONG_LONG_MAX__ * 2ULL + 1; } static const int digits = __glibcxx_digits (unsigned long long); static const int digits10 = __glibcxx_digits10 (unsigned long long); static const bool is_signed = false; static const bool is_integer = true; static const bool is_exact = true; static const int radix = 2; static unsigned long long epsilon() throw() { return 0; } static unsigned long long round_error() throw() { return 0; } static const int min_exponent = 0; static const int min_exponent10 = 0; static const int max_exponent = 0; static const int max_exponent10 = 0; static const bool has_infinity = false; static const bool has_quiet_NaN = false; static const bool has_signaling_NaN = false; static const float_denorm_style has_denorm = denorm_absent; static const bool has_denorm_loss = false; static unsigned long long infinity() throw() { return static_cast(0); } static unsigned long long quiet_NaN() throw() { return static_cast(0); } static unsigned long long signaling_NaN() throw() { return static_cast(0); } static unsigned long long denorm_min() throw() { return static_cast(0); } static const bool is_iec559 = false; static const bool is_bounded = true; static const bool is_modulo = true; static const bool traps = __glibcxx_integral_traps; static const bool tinyness_before = false; static const float_round_style round_style = round_toward_zero; }; /// numeric_limits specialization. template<> struct numeric_limits { static const bool is_specialized = true; static float min() throw() { return __FLT_MIN__; } static float max() throw() { return __FLT_MAX__; } static const int digits = __FLT_MANT_DIG__; static const int digits10 = __FLT_DIG__; static const bool is_signed = true; static const bool is_integer = false; static const bool is_exact = false; static const int radix = __FLT_RADIX__; static float epsilon() throw() { return __FLT_EPSILON__; } static float round_error() throw() { return 0.5F; } static const int min_exponent = __FLT_MIN_EXP__; static const int min_exponent10 = __FLT_MIN_10_EXP__; static const int max_exponent = __FLT_MAX_EXP__; static const int max_exponent10 = __FLT_MAX_10_EXP__; static const bool has_infinity = __FLT_HAS_INFINITY__; static const bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__; static const bool has_signaling_NaN = has_quiet_NaN; static const float_denorm_style has_denorm = bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent; static const bool has_denorm_loss = __glibcxx_float_has_denorm_loss; static float infinity() throw() { return __builtin_huge_valf (); } static float quiet_NaN() throw() { return __builtin_nanf (""); } static float signaling_NaN() throw() { return __builtin_nansf (""); } static float denorm_min() throw() { return __FLT_DENORM_MIN__; } static const bool is_iec559 = has_infinity && has_quiet_NaN && has_denorm == denorm_present; static const bool is_bounded = true; static const bool is_modulo = false; static const bool traps = __glibcxx_float_traps; static const bool tinyness_before = __glibcxx_float_tinyness_before; static const float_round_style round_style = round_to_nearest; }; #undef __glibcxx_float_has_denorm_loss #undef __glibcxx_float_traps #undef __glibcxx_float_tinyness_before /// numeric_limits specialization. template<> struct numeric_limits { static const bool is_specialized = true; static double min() throw() { return __DBL_MIN__; } static double max() throw() { return __DBL_MAX__; } static const int digits = __DBL_MANT_DIG__; static const int digits10 = __DBL_DIG__; static const bool is_signed = true; static const bool is_integer = false; static const bool is_exact = false; static const int radix = __FLT_RADIX__; static double epsilon() throw() { return __DBL_EPSILON__; } static double round_error() throw() { return 0.5; } static const int min_exponent = __DBL_MIN_EXP__; static const int min_exponent10 = __DBL_MIN_10_EXP__; static const int max_exponent = __DBL_MAX_EXP__; static const int max_exponent10 = __DBL_MAX_10_EXP__; static const bool has_infinity = __DBL_HAS_INFINITY__; static const bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__; static const bool has_signaling_NaN = has_quiet_NaN; static const float_denorm_style has_denorm = bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent; static const bool has_denorm_loss = __glibcxx_double_has_denorm_loss; static double infinity() throw() { return __builtin_huge_val(); } static double quiet_NaN() throw() { return __builtin_nan (""); } static double signaling_NaN() throw() { return __builtin_nans (""); } static double denorm_min() throw() { return __DBL_DENORM_MIN__; } static const bool is_iec559 = has_infinity && has_quiet_NaN && has_denorm == denorm_present; static const bool is_bounded = true; static const bool is_modulo = false; static const bool traps = __glibcxx_double_traps; static const bool tinyness_before = __glibcxx_double_tinyness_before; static const float_round_style round_style = round_to_nearest; }; #undef __glibcxx_double_has_denorm_loss #undef __glibcxx_double_traps #undef __glibcxx_double_tinyness_before /// numeric_limits specialization. template<> struct numeric_limits { static const bool is_specialized = true; static long double min() throw() { return __LDBL_MIN__; } static long double max() throw() { return __LDBL_MAX__; } static const int digits = __LDBL_MANT_DIG__; static const int digits10 = __LDBL_DIG__; static const bool is_signed = true; static const bool is_integer = false; static const bool is_exact = false; static const int radix = __FLT_RADIX__; static long double epsilon() throw() { return __LDBL_EPSILON__; } static long double round_error() throw() { return 0.5L; } static const int min_exponent = __LDBL_MIN_EXP__; static const int min_exponent10 = __LDBL_MIN_10_EXP__; static const int max_exponent = __LDBL_MAX_EXP__; static const int max_exponent10 = __LDBL_MAX_10_EXP__; static const bool has_infinity = __LDBL_HAS_INFINITY__; static const bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__; static const bool has_signaling_NaN = has_quiet_NaN; static const float_denorm_style has_denorm = bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent; static const bool has_denorm_loss = __glibcxx_long_double_has_denorm_loss; static long double infinity() throw() { return __builtin_huge_vall (); } static long double quiet_NaN() throw() { return __builtin_nanl (""); } static long double signaling_NaN() throw() { return __builtin_nansl (""); } static long double denorm_min() throw() { return __LDBL_DENORM_MIN__; } static const bool is_iec559 = has_infinity && has_quiet_NaN && has_denorm == denorm_present; static const bool is_bounded = true; static const bool is_modulo = false; static const bool traps = __glibcxx_long_double_traps; static const bool tinyness_before = __glibcxx_long_double_tinyness_before; static const float_round_style round_style = round_to_nearest; }; #undef __glibcxx_long_double_has_denorm_loss #undef __glibcxx_long_double_traps #undef __glibcxx_long_double_tinyness_before _GLIBCXX_END_NAMESPACE #undef __glibcxx_signed #undef __glibcxx_min #undef __glibcxx_max #undef __glibcxx_digits #undef __glibcxx_digits10 #endif // _GLIBCXX_NUMERIC_LIMITS // RTTI support for -*- C++ -*- // Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, // 2003, 2004, 2005, 2006, 2007 // Free Software Foundation // // This file is part of GCC. // // GCC is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) // any later version. // // GCC is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with GCC; see the file COPYING. If not, write to // the Free Software Foundation, 51 Franklin Street, Fifth Floor, // Boston, MA 02110-1301, USA. // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. /** @file typeinfo * This is a Standard C++ Library header. */ #ifndef _TYPEINFO #define _TYPEINFO #include #pragma GCC visibility push(default) extern "C++" { namespace __cxxabiv1 { class __class_type_info; } // namespace __cxxabiv1 // Determine whether typeinfo names for the same type are merged (in which // case comparison can just compare pointers) or not (in which case // strings must be compared and g++.dg/abi/local1.C will fail), and // whether comparison is to be implemented inline or not. By default we // use inline pointer comparison if weak symbols are available, and // out-of-line strcmp if not. Out-of-line pointer comparison is used // where the object files are to be portable to multiple systems, some of // which may not be able to use pointer comparison, but the particular // system for which libstdc++ is being built can use pointer comparison; // in particular for most ARM EABI systems, where the ABI specifies // out-of-line comparison. Inline strcmp is not currently supported. The // compiler's target configuration can override the defaults by defining // __GXX_TYPEINFO_EQUALITY_INLINE to 1 or 0 to indicate whether or not // comparison is inline, and __GXX_MERGED_TYPEINFO_NAMES to 1 or 0 to // indicate whether or not pointer comparison can be used. #ifndef __GXX_MERGED_TYPEINFO_NAMES #if !__GXX_WEAK__ // If weak symbols are not supported, typeinfo names are not merged. #define __GXX_MERGED_TYPEINFO_NAMES 0 #else // On platforms that support weak symbols, typeinfo names are merged. #define __GXX_MERGED_TYPEINFO_NAMES 1 #endif #endif // By default follow the same rules as for __GXX_MERGED_TYPEINFO_NAMES. #ifndef __GXX_TYPEINFO_EQUALITY_INLINE #if !__GXX_WEAK__ #define __GXX_TYPEINFO_EQUALITY_INLINE 0 #else #define __GXX_TYPEINFO_EQUALITY_INLINE 1 #endif #endif namespace std { /** * @brief Part of RTTI. * * The @c type_info class describes type information generated by * an implementation. */ class type_info { public: /** Destructor first. Being the first non-inline virtual function, this * controls in which translation unit the vtable is emitted. The * compiler makes use of that information to know where to emit * the runtime-mandated type_info structures in the new-abi. */ virtual ~type_info(); /** Returns an @e implementation-defined byte string; this is not * portable between compilers! */ const char* name() const { return __name; } #if !__GXX_TYPEINFO_EQUALITY_INLINE bool before(const type_info& __arg) const; // In old abi, or when weak symbols are not supported, there can // be multiple instances of a type_info object for one // type. Uniqueness must use the _name value, not object address. bool operator==(const type_info& __arg) const; #else #if !__GXX_MERGED_TYPEINFO_NAMES #error "Inline implementation of type_info comparision requires merging of type_info objects" #endif /** Returns true if @c *this precedes @c __arg in the implementation's * collation order. */ // In new abi we can rely on type_info's NTBS being unique, // and therefore address comparisons are sufficient. bool before(const type_info& __arg) const { return __name < __arg.__name; } bool operator==(const type_info& __arg) const { return __name == __arg.__name; } #endif bool operator!=(const type_info& __arg) const { return !operator==(__arg); } // Return true if this is a pointer type of some kind virtual bool __is_pointer_p() const; // Return true if this is a function type virtual bool __is_function_p() const; // Try and catch a thrown type. Store an adjusted pointer to the // caught type in THR_OBJ. If THR_TYPE is not a pointer type, then // THR_OBJ points to the thrown object. If THR_TYPE is a pointer // type, then THR_OBJ is the pointer itself. OUTER indicates the // number of outer pointers, and whether they were const // qualified. virtual bool __do_catch(const type_info *__thr_type, void **__thr_obj, unsigned __outer) const; // Internally used during catch matching virtual bool __do_upcast(const __cxxabiv1::__class_type_info *__target, void **__obj_ptr) const; protected: const char *__name; explicit type_info(const char *__n): __name(__n) { } private: /// Assigning type_info is not supported. type_info& operator=(const type_info&); type_info(const type_info&); }; /** * @brief Thrown during incorrect typecasting. * * If you attempt an invalid @c dynamic_cast expression, an instance of * this class (or something derived from this class) is thrown. */ class bad_cast : public exception { public: bad_cast() throw() { } // This declaration is not useless: // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 virtual ~bad_cast() throw(); // See comment in eh_exception.cc. virtual const char* what() const throw(); }; /** If you use a NULL pointer in a @c typeid expression, this is thrown. */ class bad_typeid : public exception { public: bad_typeid () throw() { } // This declaration is not useless: // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 virtual ~bad_typeid() throw(); // See comment in eh_exception.cc. virtual const char* what() const throw(); }; } // namespace std #pragma GCC visibility pop } // extern "C++" #endif „ . ..…stl_multimap.h† boost_concept_check.h‡functional_hash.hˆ basic_ios.h‰ hashtable.hŠ mask_array.h‹ stl_list.hŒ stl_map.hlocale_facets.hŽ slice_array.h stl_tree.hstl_uninitialized.h‘ boost_sp_shared_count.h’ stl_relops.h“ stl_queue.h”algorithmfwd.h• stl_heap.h–valarray_after.h—stl_function.h˜ stl_numeric.h™ stl_bvector.hš stl_move.h›valarray_before.hœ codecvt.hbasic_string.tccž allocator.hŸ deque.tcc list.tcc¡ostream_insert.h¢ cmath.tcc£ localefwd.h¤ stl_raw_storage_iter.h¥ locale_facets_nonio.tcc¦ basic_ios.tcc§ stl_set.h¨ stl_tempbuf.h© sstream.tccªstl_multiset.h« stl_deque.h¬ locale_facets_nonio.h­basic_string.h® vector.tcc°gslice_array.h// Multimap implementation -*- C++ -*- // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 2, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. /* * * 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 appear 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,1997 * 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 appear 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. */ /** @file stl_multimap.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ #ifndef _STL_MULTIMAP_H #define _STL_MULTIMAP_H 1 #include _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) /** * @brief A standard container made up of (key,value) pairs, which can be * retrieved based on a key, in logarithmic time. * * @ingroup Containers * @ingroup Assoc_containers * * Meets the requirements of a container, a * reversible container, and an * associative container (using equivalent * keys). For a @c multimap the key_type is Key, the mapped_type * is T, and the value_type is std::pair. * * Multimaps support bidirectional iterators. * * The private tree data is declared exactly the same way for map and * multimap; the distinction is made entirely in how the tree functions are * called (*_unique versus *_equal, same as the standard). */ template , typename _Alloc = std::allocator > > class multimap { public: typedef _Key key_type; typedef _Tp mapped_type; typedef std::pair value_type; typedef _Compare key_compare; typedef _Alloc allocator_type; private: // concept requirements typedef typename _Alloc::value_type _Alloc_value_type; __glibcxx_class_requires(_Tp, _SGIAssignableConcept) __glibcxx_class_requires4(_Compare, bool, _Key, _Key, _BinaryFunctionConcept) __glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept) public: class value_compare : public std::binary_function { friend class multimap<_Key, _Tp, _Compare, _Alloc>; protected: _Compare comp; value_compare(_Compare __c) : comp(__c) { } public: bool operator()(const value_type& __x, const value_type& __y) const { return comp(__x.first, __y.first); } }; private: /// This turns a red-black tree into a [multi]map. typedef typename _Alloc::template rebind::other _Pair_alloc_type; typedef _Rb_tree, key_compare, _Pair_alloc_type> _Rep_type; /// The actual tree structure. _Rep_type _M_t; public: // many of these are specified differently in ISO, but the following are // "functionally equivalent" typedef typename _Pair_alloc_type::pointer pointer; typedef typename _Pair_alloc_type::const_pointer const_pointer; typedef typename _Pair_alloc_type::reference reference; typedef typename _Pair_alloc_type::const_reference const_reference; typedef typename _Rep_type::iterator iterator; typedef typename _Rep_type::const_iterator const_iterator; typedef typename _Rep_type::size_type size_type; typedef typename _Rep_type::difference_type difference_type; typedef typename _Rep_type::reverse_iterator reverse_iterator; typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; // [23.3.2] construct/copy/destroy // (get_allocator() is also listed in this section) /** * @brief Default constructor creates no elements. */ multimap() : _M_t() { } /** * @brief Creates a %multimap with no elements. * @param comp A comparison object. * @param a An allocator object. */ explicit multimap(const _Compare& __comp, const allocator_type& __a = allocator_type()) : _M_t(__comp, __a) { } /** * @brief %Multimap copy constructor. * @param x A %multimap of identical element and allocator types. * * The newly-created %multimap uses a copy of the allocation object * used by @a x. */ multimap(const multimap& __x) : _M_t(__x._M_t) { } #ifdef __GXX_EXPERIMENTAL_CXX0X__ /** * @brief %Multimap move constructor. * @param x A %multimap of identical element and allocator types. * * The newly-created %multimap contains the exact contents of @a x. * The contents of @a x are a valid, but unspecified %multimap. */ multimap(multimap&& __x) : _M_t(std::forward<_Rep_type>(__x._M_t)) { } #endif /** * @brief Builds a %multimap from a range. * @param first An input iterator. * @param last An input iterator. * * Create a %multimap consisting of copies of the elements from * [first,last). This is linear in N if the range is already sorted, * and NlogN otherwise (where N is distance(first,last)). */ template multimap(_InputIterator __first, _InputIterator __last) : _M_t() { _M_t._M_insert_equal(__first, __last); } /** * @brief Builds a %multimap from a range. * @param first An input iterator. * @param last An input iterator. * @param comp A comparison functor. * @param a An allocator object. * * Create a %multimap consisting of copies of the elements from * [first,last). This is linear in N if the range is already sorted, * and NlogN otherwise (where N is distance(first,last)). */ template multimap(_InputIterator __first, _InputIterator __last, const _Compare& __comp, const allocator_type& __a = allocator_type()) : _M_t(__comp, __a) { _M_t._M_insert_equal(__first, __last); } // FIXME There is no dtor declared, but we should have something generated // by Doxygen. I don't know what tags to add to this paragraph to make // that happen: /** * The dtor only erases the elements, and note that if the elements * themselves are pointers, the pointed-to memory is not touched in any * way. Managing the pointer is the user's responsibility. */ /** * @brief %Multimap assignment operator. * @param x A %multimap of identical element and allocator types. * * All the elements of @a x are copied, but unlike the copy constructor, * the allocator object is not copied. */ multimap& operator=(const multimap& __x) { _M_t = __x._M_t; return *this; } #ifdef __GXX_EXPERIMENTAL_CXX0X__ /** * @brief %Multimap move assignment operator. * @param x A %multimap of identical element and allocator types. * * The contents of @a x are moved into this multimap (without copying). * @a x is a valid, but unspecified multimap. */ multimap& operator=(multimap&& __x) { // NB: DR 675. this->clear(); this->swap(__x); return *this; } #endif /// Get a copy of the memory allocation object. allocator_type get_allocator() const { return _M_t.get_allocator(); } // iterators /** * Returns a read/write iterator that points to the first pair in the * %multimap. Iteration is done in ascending order according to the * keys. */ iterator begin() { return _M_t.begin(); } /** * Returns a read-only (constant) iterator that points to the first pair * in the %multimap. Iteration is done in ascending order according to * the keys. */ const_iterator begin() const { return _M_t.begin(); } /** * Returns a read/write iterator that points one past the last pair in * the %multimap. Iteration is done in ascending order according to the * keys. */ iterator end() { return _M_t.end(); } /** * Returns a read-only (constant) iterator that points one past the last * pair in the %multimap. Iteration is done in ascending order according * to the keys. */ const_iterator end() const { return _M_t.end(); } /** * Returns a read/write reverse iterator that points to the last pair in * the %multimap. Iteration is done in descending order according to the * keys. */ reverse_iterator rbegin() { return _M_t.rbegin(); } /** * Returns a read-only (constant) reverse iterator that points to the * last pair in the %multimap. Iteration is done in descending order * according to the keys. */ const_reverse_iterator rbegin() const { return _M_t.rbegin(); } /** * Returns a read/write reverse iterator that points to one before the * first pair in the %multimap. Iteration is done in descending order * according to the keys. */ reverse_iterator rend() { return _M_t.rend(); } /** * Returns a read-only (constant) reverse iterator that points to one * before the first pair in the %multimap. Iteration is done in * descending order according to the keys. */ const_reverse_iterator rend() const { return _M_t.re &!&"&#&$&%&&&'&(&)&*&+&,&-&.&/&nd(); } #ifdef __GXX_EXPERIMENTAL_CXX0X__ /** * Returns a read-only (constant) iterator that points to the first pair * in the %multimap. Iteration is done in ascending order according to * the keys. */ const_iterator cbegin() const { return _M_t.begin(); } /** * Returns a read-only (constant) iterator that points one past the last * pair in the %multimap. Iteration is done in ascending order according * to the keys. */ const_iterator cend() const { return _M_t.end(); } /** * Returns a read-only (constant) reverse iterator that points to the * last pair in the %multimap. Iteration is done in descending order * according to the keys. */ const_reverse_iterator crbegin() const { return _M_t.rbegin(); } /** * Returns a read-only (constant) reverse iterator that points to one * before the first pair in the %multimap. Iteration is done in * descending order according to the keys. */ const_reverse_iterator crend() const { return _M_t.rend(); } #endif // capacity /** Returns true if the %multimap is empty. */ bool empty() const { return _M_t.empty(); } /** Returns the size of the %multimap. */ size_type size() const { return _M_t.size(); } /** Returns the maximum size of the %multimap. */ size_type max_size() const { return _M_t.max_size(); } // modifiers /** * @brief Inserts a std::pair into the %multimap. * @param x Pair to be inserted (see std::make_pair for easy creation * of pairs). * @return An iterator that points to the inserted (key,value) pair. * * This function inserts a (key, value) pair into the %multimap. * Contrary to a std::map the %multimap does not rely on unique keys and * thus multiple pairs with the same key can be inserted. * * Insertion requires logarithmic time. */ iterator insert(const value_type& __x) { return _M_t._M_insert_equal(__x); } /** * @brief Inserts a std::pair into the %multimap. * @param position An iterator that serves as a hint as to where the * pair should be inserted. * @param x Pair to be inserted (see std::make_pair for easy creation * of pairs). * @return An iterator that points to the inserted (key,value) pair. * * This function inserts a (key, value) pair into the %multimap. * Contrary to a std::map the %multimap does not rely on unique keys and * thus multiple pairs with the same key can be inserted. * Note that the first parameter is only a hint and can potentially * improve the performance of the insertion process. A bad hint would * cause no gains in efficiency. * * For more on "hinting," see: * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html * * Insertion requires logarithmic time (if the hint is not taken). */ iterator insert(iterator __position, const value_type& __x) { return _M_t._M_insert_equal_(__position, __x); } /** * @brief A template function that attempts to insert a range * of elements. * @param first Iterator pointing to the start of the range to be * inserted. * @param last Iterator pointing to the end of the range. * * Complexity similar to that of the range constructor. */ template void insert(_InputIterator __first, _InputIterator __last) { _M_t._M_insert_equal(__first, __last); } /** * @brief Erases an element from a %multimap. * @param position An iterator pointing to the element to be erased. * * This function erases an element, pointed to by the given iterator, * from a %multimap. Note that this function only erases the element, * and that if the element is itself a pointer, the pointed-to memory is * not touched in any way. Managing the pointer is the user's * responsibility. */ void erase(iterator __position) { _M_t.erase(__position); } /** * @brief Erases elements according to the provided key. * @param x Key of element to be erased. * @return The number of elements erased. * * This function erases all elements located by the given key from a * %multimap. * Note that this function only erases the element, and that if * the element is itself a pointer, the pointed-to memory is not touched * in any way. Managing the pointer is the user's responsibility. */ size_type erase(const key_type& __x) { return _M_t.erase(__x); } /** * @brief Erases a [first,last) range of elements from a %multimap. * @param first Iterator pointing to the start of the range to be * erased. * @param last Iterator pointing to the end of the range to be erased. * * This function erases a sequence of elements from a %multimap. * Note that this function only erases the elements, and that if * the elements themselves are pointers, the pointed-to memory is not * touched in any way. Managing the pointer is the user's responsibility. */ void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last); } /** * @brief Swaps data with another %multimap. * @param x A %multimap of the same element and allocator types. * * This exchanges the elements between two multimaps in constant time. * (It is only swapping a pointer, an integer, and an instance of * the @c Compare type (which itself is often stateless and empty), so it * should be quite fast.) * Note that the global std::swap() function is specialized such that * std::swap(m1,m2) will feed to this function. */ void #ifdef __GXX_EXPERIMENTAL_CXX0X__ swap(multimap&& __x) #else swap(multimap& __x) #endif { _M_t.swap(__x._M_t); } /** * Erases all elements in a %multimap. Note that this function only * erases the elements, and that if the elements themselves are pointers, * the pointed-to memory is not touched in any way. Managing the pointer * is the user's responsibility. */ void clear() { _M_t.clear(); } // observers /** * Returns the key comparison object out of which the %multimap * was constructed. */ key_compare key_comp() const { return _M_t.key_comp(); } /** * Returns a value comparison object, built from the key comparison * object out of which the %multimap was constructed. */ value_compare value_comp() const { return value_compare(_M_t.key_comp()); } // multimap operations /** * @brief Tries to locate an element in a %multimap. * @param x Key of (key, value) pair to be located. * @return Iterator pointing to sought-after element, * or end() if not found. * * This function takes a key and tries to locate the element with which * the key matches. If successful the function returns an iterator * pointing to the sought after %pair. If unsuccessful it returns the * past-the-end ( @c end() ) iterator. */ iterator find(const key_type& __x) { return _M_t.find(__x); } /** * @brief Tries to locate an element in a %multimap. * @param x Key of (key, value) pair to be located. * @return Read-only (constant) iterator pointing to sought-after * element, or end() if not found. * * This function takes a key and tries to locate the element with which * the key matches. If successful the function returns a constant * iterator pointing to the sought after %pair. If unsuccessful it * returns the past-the-end ( @c end() ) iterator. */ const_iterator find(const key_type& __x) const { return _M_t.find(__x); } /** * @brief Finds the number of elements with given key. * @param x Key of (key, value) pairs to be located. * @return Number of elements with specified key. */ size_type count(const key_type& __x) const { return _M_t.count(__x); } /** * @brief Finds the beginning of a subsequence matching given key. * @param x Key of (key, value) pair to be located. * @return Iterator pointing to first element equal to or greater * than key, or end(). * * This function returns the first element of a subsequence of elements * that matches the given key. If unsuccessful it returns an iterator * pointing to the first element that has a greater value than given key * or end() if no such element exists. */ iterator lower_bound(const key_type& __x) { return _M_t.lower_bound(__x); } /** * @brief Finds the beginning of a subsequence matching given key. * @param x Key of (key, value) pair to be located. * @return Read-only (constant) iterator pointing to first element * equal to or greater than key, or end(). * * This function returns the first element of a subsequence of elements * that matches the given key. If unsuccessful the iterator will point * to the next greatest element or, if no such greater element exists, to * end(). */ const_iterator lower_bound(const key_type& __x) const { return _M_t.lower_bound(__x); } /** * @brief Finds the end of a subsequence matching given key. * @param x Key of (key, value) pair to be located. * @return Iterator pointing to the first element * greater than key, or end(). */ iterator upper_bound(const key_type& __x) { return _M_t.upper_bound(__x); } /** * @brief Finds the end of a subsequence matching given key. * @param x Key of (key, value) pair to be located. * @return Read-only (constant) iterator pointing to first iterator * greater than key, or end(). */ const_iterator upper_bound(const key_type& __x) const { return _M_t.upper_bound(__x); } /** * @brief Finds a subsequence matching given key. * @param x Key of (key, value) pairs to be located. * @return Pair of iterators that possibly points to the subsequence * matching given key. * * This function is equivalent to * @code * std::make_pair(c.lower_bound(val), * c.upper_bound(val)) * @endcode * (but is faster than making the calls separately). */ std::pair equal_range(const key_type& __x) { return _M_t.equal_range(__x); } /** * @brief Finds a subsequence matching given key. * @param x Key of (key, value) pairs to be located. * @return Pair of read-only (constant) iterators that possibly points * to the subsequence matching given key. * * This function is equivalent to * @code * std::make_pair(c.lower_bound(val), * c.upper_bound(val)) * @endcode * (but is faster than making the calls separately). */ std::pair equal_range(const key_type& __x) const { return _M_t.equal_range(__x); } template friend bool operator==(const multimap<_K1, _T1, _C1, _A1>&, const multimap<_K1, _T1, _C1, _A1>&); template friend bool operator<(const multimap<_K1, _T1, _C1, _A1>&, const multimap<_K1, _T1, _C1, _A1>&); }; /** * @brief Multimap equality comparison. * @param x A %multimap. * @param y A %multimap of the same type as @a x. * @return True iff the size and elements of the maps are equal. * * This is an equivalence relation. It is linear in the size of the * multimaps. Multimaps are considered equivalent if their sizes are equal, * and if corresponding elements compare equal. */ template inline bool operator==(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, const multimap<_Key, _Tp, _Compare, _Alloc>& __y) { return __x._M_t == __y._M_t; } /** * @brief Multimap ordering relation. * @param x A %multimap. * @param y A %multimap of the same type as @a x. * @return True iff @a x is lexicographically less than @a y. * * This is a total ordering relation. It is linear in the size of the * multimaps. The elements must be comparable with @c <. * * See std::lexicographical_compare() for how the determination is made. */ template inline bool operator<(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, const multimap<_Key, _Tp, _Compare, _Alloc>& __y) { return __x._M_t < __y._M_t; } /// Based on operator== template inline bool operator!=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, const multimap<_Key, _Tp, _Compare, _Alloc>& __y) { return !(__x == __y); } /// Based on operator< template inline bool operator>(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, const multimap<_Key, _Tp, _Compare, _Alloc>& __y) { return __y < __x; } /// Based on operator< template inline bool operator<=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, const multimap<_Key, _Tp, _Compare, _Alloc>& __y) { return !(__y < __x); } /// Based on operator< template inline bool operator>=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, const multimap<_Key, _Tp, _Compare, _Alloc>& __y) { return !(__x < __y); } /// See std::multimap::swap(). template inline void swap(multimap<_Key, _Tp, _Compare, _Alloc>& __x, multimap<_Key, _Tp, _Compare, _Alloc>& __y) { __x.swap(__y); } #ifdef __GXX_EXPERIMENTAL_CXX0X__ template inline void swap(multimap<_Key, _Tp, _Compare, _Alloc>&& __x, multimap<_Key, _Tp, _Compare, _Alloc>& __y) { __x.swap(__y); } template inline void swap(multimap<_Key, _Tp, _Compare, _Alloc>& __x, multimap<_Key, _Tp, _Compare, _Alloc>&& __y) { __x.swap(__y); } #endif _GLIBCXX_END_NESTED_NAMESPACE #endif /* _STL_MULTIMAP_H */ // -*- C++ -*- // Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 2, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. // (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. // /** @file boost_concept_check.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ // GCC Note: based on version 1.12.0 of the Boost library. #ifndef _BOOST_CONCEPT_CHECK_H #define _BOOST_CONCEPT_CHECK_H 1 #pragma GCC system_header #include // for ptrdiff_t, used next #include // for traits and tags _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) #define _IsUnused __attribute__ ((__unused__)) // When the C-C code is in use, we would like this function to do as little // as possible at runtime, use as few resources as possible, and hopefully // be elided out of existence... hmmm. template inline void __function_requires() { void (_Concept::*__x)() _IsUnused = &_Concept::__constraints; } // No definition: if this is referenced, there's a problem with // the instantiating type not being one of the required integer types. // Unfortunately, this results in a link-time error, not a compile-time error. void __error_type_must_be_an_integer_type(); void __error_type_must_be_an_unsigned_integer_type(); void __error_type_must_be_a_signed_integer_type(); // ??? Should the "concept_checking*" structs begin with more than _ ? #define _GLIBCXX_CLASS_REQUIRES(_type_var, _ns, _concept) \ typedef void (_ns::_concept <_type_var>::* _func##_type_var##_concept)(); \ template <_func##_type_var##_concept _Tp1> \ struct _concept_checking##_type_var##_concept { }; \ typedef _concept_checking##_type_var##_concept< \ &_ns::_concept <_type_var>::__constraints> \ _concept_checking_typedef##_type_var##_concept #define _GLIBCXX_CLASS_REQUIRES2(_type_var1, _type_var2, _ns, _concept) \ typedef void (_ns::_concept <_type_var1,_type_var2>::* _func##_type_var1##_type_var2##_concept)(); \ template <_func##_type_var1##_type_var2##_concept _Tp1> \ struct _concept_checking##_type_var1##_type_var2##_concept { }; \ typedef _concept_checking##_type_var1##_type_var2##_concept< \ &_ns::_concept <_type_var1,_type_var2>::__constraints> \ _concept_checking_typedef##_type_var1##_type_var2##_concept #define _GLIBCXX_CLASS_REQUIRES3(_type_var1, _type_var2, _type_var3, _ns, _concept) \ typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3>::* _func##_type_var1##_type_var2##_type_var3##_concept)(); \ template <_func##_type_var1##_type_var2##_type_var3##_concept _Tp1> \ struct _concept_checking##_type_var1##_type_var2##_type_var3##_concept { }; \ typedef _concept_checking##_type_var1##_type_var2##_type_var3##_concept< \ &_ns::_concept <_type_var1,_type_var2,_type_var3>::__constraints> \ _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_concept #define _GLIBCXX_CLASS_REQUIRES4(_type_var1, _type_var2, _type_var3, _type_var4, _ns, _concept) \ typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::* _func##_type_var1##_type_var2##_type_var3##_type_var4##_concept)(); \ template <_func##_type_var1##_type_var2##_type_var3##_type_var4##_concept _Tp1> \ struct _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept { }; \ typedef _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept< \ &_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::__constraints> \ _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_type_var4##_concept template struct _Aux_require_same { }; template struct _Aux_require_same<_Tp,_Tp> { typedef _Tp _Type; }; template struct _SameTypeConcept { void __constraints() { typedef typename _Aux_require_same<_Tp1, _Tp2>::_Type _Required; } }; template struct _IntegerConcept { void __constraints() { __error_type_must_be_an_integer_type(); } }; template <> struct _IntegerConcept { void __constraints() {} }; template <> struct _IntegerConcept { void __constraints(){} }; template <> struct _IntegerConcept { void __constraints() {} }; template <> struct _IntegerConcept { void __constraints() {} }; template <> struct _IntegerConcept { void __constraints() {} }; template <> struct _IntegerConcept { void __constraints() {} }; template <> struct _IntegerConcept { void __constraints() {} }; template <> struct _IntegerConcept { void __constraints() {} }; template struct _SignedIntegerConcept { void __constraints() { __error_type_must_be_a_signed_integer_type(); } }; template <> struct _SignedIntegerConcept { void __constraints() {} }; template <> struct _SignedIntegerConcept { void __constraints() {} }; template <> struct _SignedIntegerConcept { void __constraints() {} }; template <> struct _SignedIntegerConcept { void __constraints(){}}; template struct _UnsignedIntegerConcept { void __constraints() { __error_type_must_be_an_unsigned_integer_type(); } }; template <> struct _UnsignedIntegerConcept { void __constraints() {} }; template <> struct _UnsignedIntegerConcept { void __constraints() {} }; template <> struct _UnsignedIntegerConcept { void __constraints() {} }; template <> struct _UnsignedIntegerConcept { void __constraints() {} }; //=========================================================================== // Basic Concepts template struct _DefaultConstructibleConcept { void __constraints() { _Tp __a _IsUnused; // require default constructor } }; template struct _AssignableConcept { void __constraints() { __a = __a; // require assignment operator __const_constraints(__a); } void __const_constraints(const _Tp& __b) { __a = __b; // const required for argument to assignment } _Tp __a; // possibly should be "Tp* a;" and then dereference "a" in constraint // functions? present way would require a default ctor, i think... }; template struct _CopyConstructibleConcept { void __constraints() { _Tp __a(__b); // require copy constructor _Tp* __ptr _IsUnused = &__a; // require address of operator __const_constraints(__a); } void __const_constraints(const _Tp& __a) { _Tp __c _IsUnused(__a); // require const copy constructor const _Tp* __ptr _IsUnused = &__a; // require const address of operator } _Tp __b; }; // The SGI STL version of Assignable requires copy constructor and operator= template struct _SGIAssignableConcept { void __constraints() { _Tp __b _IsUnused(__a); __a = __a; // require assignment operator __const_constraints(__a); } void __const_constraints(const _Tp& __b) { _Tp __c _IsUnused(__b); __a = __b; // const required for argument to assignment } _Tp __a; }; template struct _ConvertibleConcept { void __constraints() { _To __y _IsUnused = __x; } _From __x; }; // The C++ standard requirements for many concepts talk about return // types that must be "convertible to bool". The problem with this // requirement is that it leaves the door open for evil proxies that // define things like operator|| with strange return types. Two // possible solutions are: // 1) require the return type to be exactly bool // 2) stay with convertible to bool, and also // specify stuff about all the logical operators. // For now we just test for convertible to bool. template void __aux_require_boolean_expr(const _Tp& __t) { bool __x _IsUnused = __t; } // FIXME template struct _EqualityComparableConcept { void __constraints() { __aux_require_boolean_expr(__a == __b); } _Tp __a, __b; }; template struct _LessThanComparableConcept { void __constraints() { __aux_require_boolean_expr(__a < __b); } _Tp __a, __b; }; // This is equivalent to SGI STL's LessThanComparable. template struct _ComparableConcept { void __constraints() { __aux_require_boolean_expr(__a < __b); __aux_require_boolean_expr(__a > __b); __aux_require_boolean_expr(__a <= __b); __aux_require_boolean_expr(__a >= __b); } _Tp __a, __b; }; #define _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(_OP,_NAME) \ template \ struct _NAME { \ void __constraints() { (void)__constraints_(); } \ bool __constraints_() { \ return __a _OP __b; \ } \ _First __a; \ _Second __b; \ } #define _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(_OP,_NAME) \ template \ struct _NAME { \ void __constraints() { (void)__constraints_(); } \ _Ret __constraints_() { \ return __a _OP __b; \ } \ _First __a; \ _Second __b; \ } _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(==, _EqualOpConcept); _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(!=, _NotEqualOpConcept); _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<, _LessThanOpConcept); _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<=, _LessEqualOpConcept); _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>, _GreaterThanOpConcept); _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>=, _GreaterEqualOpConcept); _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, _PlusOpConcept); _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, _TimesOpConcept); _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, _DivideOpConcept); _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, _SubtractOpConcept); _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, _ModOpConcept); #undef _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT #undef _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT //=========================================================================== // Function Object Concepts template struct _GeneratorConcept { void __constraints() { const _Return& __r _IsUnused = __f();// require operator() member function } _Func __f; }; =&>&?&@&A&B&C&D&E&F&G&H&I&J&K& template struct _GeneratorConcept<_Func,void> { void __constraints() { __f(); // require operator() member function } _Func __f; }; template struct _UnaryFunctionConcept { void __constraints() { __r = __f(__arg); // require operator() } _Func __f; _Arg __arg; _Return __r; }; template struct _UnaryFunctionConcept<_Func, void, _Arg> { void __constraints() { __f(__arg); // require operator() } _Func __f; _Arg __arg; }; template struct _BinaryFunctionConcept { void __constraints() { __r = __f(__first, __second); // require operator() } _Func __f; _First __first; _Second __second; _Return __r; }; template struct _BinaryFunctionConcept<_Func, void, _First, _Second> { void __constraints() { __f(__first, __second); // require operator() } _Func __f; _First __first; _Second __second; }; template struct _UnaryPredicateConcept { void __constraints() { __aux_require_boolean_expr(__f(__arg)); // require op() returning bool } _Func __f; _Arg __arg; }; template struct _BinaryPredicateConcept { void __constraints() { __aux_require_boolean_expr(__f(__a, __b)); // require op() returning bool } _Func __f; _First __a; _Second __b; }; // use this when functor is used inside a container class like std::set template struct _Const_BinaryPredicateConcept { void __constraints() { __const_constraints(__f); } void __const_constraints(const _Func& __fun) { __function_requires<_BinaryPredicateConcept<_Func, _First, _Second> >(); // operator() must be a const member function __aux_require_boolean_expr(__fun(__a, __b)); } _Func __f; _First __a; _Second __b; }; //=========================================================================== // Iterator Concepts template struct _TrivialIteratorConcept { void __constraints() { // __function_requires< _DefaultConstructibleConcept<_Tp> >(); __function_requires< _AssignableConcept<_Tp> >(); __function_requires< _EqualityComparableConcept<_Tp> >(); // typedef typename std::iterator_traits<_Tp>::value_type _V; (void)*__i; // require dereference operator } _Tp __i; }; template struct _Mutable_TrivialIteratorConcept { void __constraints() { __function_requires< _TrivialIteratorConcept<_Tp> >(); *__i = *__j; // require dereference and assignment } _Tp __i, __j; }; template struct _InputIteratorC