+2001-03-04 Phil Edwards <pme@sources.redhat.com>
+
+ http://gcc.gnu.org/ml/libstdc++/2001-03/msg00015.html
+ * include/backward/algo.h: Use std not __STD. Remove unneeded
+ macros and "never happens" code. Adjust to C++STYLE guidelines.
+ * include/backward/algobase.h: Likewise.
+ * include/backward/alloc.h: Likewise.
+ * include/backward/bvector.h: Likewise.
+ * include/backward/deque.h: Likewise.
+ * include/backward/function.h: Likewise.
+ * include/backward/hash_map.h: Likewise.
+ * include/backward/hash_set.h: Likewise.
+ * include/backward/hashtable.h: Likewise.
+ * include/backward/heap.h: Likewise.
+ * include/backward/iterator.h: Likewise.
+ * include/backward/list.h: Likewise.
+ * include/backward/map.h: Likewise.
+ * include/backward/multimap.h: Likewise.
+ * include/backward/multiset.h: Likewise.
+ * include/backward/pair.h: Likewise.
+ * include/backward/rope.h: Likewise.
+ * include/backward/set.h: Likewise.
+ * include/backward/slist.h: Likewise.
+ * include/backward/stack.h: Likewise.
+ * include/backward/strstream: Likewise.
+ * include/backward/tempbuf.h: Likewise.
+ * include/backward/tree.h: Likewise.
+ * include/backward/vector.h: Likewise.
+ * include/bits/basic_ios.h: Likewise.
+ * include/bits/basic_ios.tcc: Likewise.
+ * include/bits/basic_string.h: Likewise.
+ * include/bits/c++config: Likewise.
+ * include/bits/concept_checks.h: Likewise.
+ * include/bits/fpos.h: Likewise.
+ * include/bits/fstream.tcc: Likewise.
+ * include/bits/functexcept.h: Likewise.
+ * include/bits/ios_base.h: Likewise.
+ * include/bits/istream.tcc: Likewise.
+ * include/bits/mask_array.h: Likewise.
+ * include/bits/ostream.tcc: Likewise.
+ * include/bits/pthread_allocimpl.h: Likewise.
+ * include/bits/sbuf_iter.h: Likewise.
+ * include/bits/slice.h: Likewise.
+ * include/bits/slice_array.h: Likewise.
+ * include/bits/sstream.tcc: Likewise.
+ * include/bits/std_bitset.h: Likewise.
+ * include/bits/std_fstream.h: Likewise.
+ * include/bits/std_iomanip.h: Likewise.
+ * include/bits/std_ios.h: Likewise.
+ * include/bits/std_istream.h: Likewise.
+ * include/bits/std_iterator.h: Likewise.
+ * include/bits/std_memory.h: Likewise.
+ * include/bits/std_ostream.h: Likewise.
+ * include/bits/std_sstream.h: Likewise.
+ * include/bits/std_streambuf.h: Likewise.
+ * include/bits/std_string.h: Likewise.
+ * include/bits/std_valarray.h: Likewise.
+ * include/bits/stl_algo.h: Likewise.
+ * include/bits/stl_algobase.h: Likewise.
+ * include/bits/stl_alloc.h: Likewise.
+ * include/bits/stl_construct.h: Likewise.
+ * include/bits/stl_deque.h: Likewise.
+ * include/bits/stl_function.h: Likewise.
+ * include/bits/stl_heap.h: Likewise.
+ * include/bits/stl_iterator.h: Likewise.
+ * include/bits/stl_iterator_base.h: Likewise.
+ * include/bits/stl_list.h: Likewise.
+ * include/bits/stl_map.h: Likewise.
+ * include/bits/stl_multimap.h: Likewise.
+ * include/bits/stl_multiset.h: Likewise.
+ * include/bits/stl_numeric.h: Likewise.
+ * include/bits/stl_pair.h: Likewise.
+ * include/bits/stl_pthread_alloc.h: Likewise.
+ * include/bits/stl_queue.h: Likewise.
+ * include/bits/stl_raw_storage_iter.h: Likewise.
+ * include/bits/stl_relops.h: Likewise.
+ * include/bits/stl_set.h: Likewise.
+ * include/bits/stl_stack.h: Likewise.
+ * include/bits/stl_tempbuf.h: Likewise.
+ * include/bits/stl_threads.h: Likewise.
+ * include/bits/stl_tree.h: Likewise.
+ * include/bits/stl_uninitialized.h: Likewise.
+ * include/bits/stl_vector.h: Likewise.
+ * include/bits/streambuf.tcc: Likewise.
+ * include/bits/type_traits.h: Likewise.
+ * include/bits/valarray_meta.h: Likewise.
+ * include/ext/bvector: Likewise.
+ * include/ext/hash_map: Likewise.
+ * include/ext/hash_set: Likewise.
+ * include/ext/ropeimpl.h: Likewise.
+ * include/ext/slist: Likewise.
+ * include/ext/stl_bvector.h: Likewise.
+ * include/ext/stl_hash_fun.h: Likewise.
+ * include/ext/stl_hashtable.h: Likewise.
+ * include/ext/stl_rope.h: Likewise.
+ * src/complex_io.cc: Likewise.
+ * src/ios.cc: Likewise.
+ * src/locale-inst.cc: Likewise.
+ * src/locale.cc: Likewise.
+ * src/localename.cc: Likewise.
+ * src/misc-inst.cc: Likewise.
+ * src/stdexcept.cc: Likewise.
+ * src/stl-inst.cc: Likewise.
+ * src/strstream.cc: Likewise.
+ * src/valarray-inst.cc: Likewise.
+
2001-03-03 Benjamin Kosnik <bkoz@redhat.com>
* src/misc-inst.cc (__copy_streambufs): Fix typo for alpha.
#include <bits/stl_algo.h>
#include <bits/stl_numeric.h>
-#ifdef __STL_USE_NAMESPACES
-
// Names from <stl_algo.h>
-using __STD::for_each;
-using __STD::find;
-using __STD::find_if;
-using __STD::adjacent_find;
-using __STD::count;
-using __STD::count_if;
-using __STD::search;
-using __STD::search_n;
-using __STD::swap_ranges;
-using __STD::transform;
-using __STD::replace;
-using __STD::replace_if;
-using __STD::replace_copy;
-using __STD::replace_copy_if;
-using __STD::generate;
-using __STD::generate_n;
-using __STD::remove;
-using __STD::remove_if;
-using __STD::remove_copy;
-using __STD::remove_copy_if;
-using __STD::unique;
-using __STD::unique_copy;
-using __STD::reverse;
-using __STD::reverse_copy;
-using __STD::rotate;
-using __STD::rotate_copy;
-using __STD::random_shuffle;
-using __STD::random_sample;
-using __STD::random_sample_n;
-using __STD::partition;
-using __STD::stable_partition;
-using __STD::sort;
-using __STD::stable_sort;
-using __STD::partial_sort;
-using __STD::partial_sort_copy;
-using __STD::nth_element;
-using __STD::lower_bound;
-using __STD::upper_bound;
-using __STD::equal_range;
-using __STD::binary_search;
-using __STD::merge;
-using __STD::inplace_merge;
-using __STD::includes;
-using __STD::set_union;
-using __STD::set_intersection;
-using __STD::set_difference;
-using __STD::set_symmetric_difference;
-using __STD::min_element;
-using __STD::max_element;
-using __STD::next_permutation;
-using __STD::prev_permutation;
-using __STD::find_first_of;
-using __STD::find_end;
-using __STD::is_sorted;
-using __STD::is_heap;
+using std::for_each;
+using std::find;
+using std::find_if;
+using std::adjacent_find;
+using std::count;
+using std::count_if;
+using std::search;
+using std::search_n;
+using std::swap_ranges;
+using std::transform;
+using std::replace;
+using std::replace_if;
+using std::replace_copy;
+using std::replace_copy_if;
+using std::generate;
+using std::generate_n;
+using std::remove;
+using std::remove_if;
+using std::remove_copy;
+using std::remove_copy_if;
+using std::unique;
+using std::unique_copy;
+using std::reverse;
+using std::reverse_copy;
+using std::rotate;
+using std::rotate_copy;
+using std::random_shuffle;
+using std::random_sample;
+using std::random_sample_n;
+using std::partition;
+using std::stable_partition;
+using std::sort;
+using std::stable_sort;
+using std::partial_sort;
+using std::partial_sort_copy;
+using std::nth_element;
+using std::lower_bound;
+using std::upper_bound;
+using std::equal_range;
+using std::binary_search;
+using std::merge;
+using std::inplace_merge;
+using std::includes;
+using std::set_union;
+using std::set_intersection;
+using std::set_difference;
+using std::set_symmetric_difference;
+using std::min_element;
+using std::max_element;
+using std::next_permutation;
+using std::prev_permutation;
+using std::find_first_of;
+using std::find_end;
+using std::is_sorted;
+using std::is_heap;
// Names from stl_heap.h
-using __STD::push_heap;
-using __STD::pop_heap;
-using __STD::make_heap;
-using __STD::sort_heap;
+using std::push_heap;
+using std::pop_heap;
+using std::make_heap;
+using std::sort_heap;
// Names from stl_numeric.h
-using __STD::accumulate;
-using __STD::inner_product;
-using __STD::partial_sum;
-using __STD::adjacent_difference;
-using __STD::power;
-using __STD::iota;
-
-#endif /* __STL_USE_NAMESPACES */
+using std::accumulate;
+using std::inner_product;
+using std::partial_sum;
+using std::adjacent_difference;
+using std::power;
+using std::iota;
#endif /* _CPP_BACKWARD_ALGO_H */
#include <bits/stl_uninitialized.h>
#endif
-#ifdef __STL_USE_NAMESPACES
-
// Names from stl_algobase.h
-using __STD::iter_swap;
-using __STD::swap;
-using __STD::min;
-using __STD::max;
-using __STD::copy;
-using __STD::copy_backward;
-using __STD::copy_n;
-using __STD::fill;
-using __STD::fill_n;
-using __STD::mismatch;
-using __STD::equal;
-using __STD::lexicographical_compare;
-using __STD::lexicographical_compare_3way;
+using std::iter_swap;
+using std::swap;
+using std::min;
+using std::max;
+using std::copy;
+using std::copy_backward;
+using std::copy_n;
+using std::fill;
+using std::fill_n;
+using std::mismatch;
+using std::equal;
+using std::lexicographical_compare;
+using std::lexicographical_compare_3way;
// Names from stl_uninitialized.h
-using __STD::uninitialized_copy;
-using __STD::uninitialized_copy_n;
-using __STD::uninitialized_fill;
-using __STD::uninitialized_fill_n;
-
-#endif /* __STL_USE_NAMESPACES */
+using std::uninitialized_copy;
+using std::uninitialized_copy_n;
+using std::uninitialized_fill;
+using std::uninitialized_fill_n;
#endif /* _CPP_BACKWARD_ALGOBASE_H */
#include <bits/stl_alloc.h>
#endif
-#ifdef __STL_USE_NAMESPACES
-
-using __STD::__malloc_alloc_template;
-using __STD::malloc_alloc;
-using __STD::simple_alloc;
-using __STD::debug_alloc;
+using std::__malloc_alloc_template;
+using std::malloc_alloc;
+using std::simple_alloc;
+using std::debug_alloc;
#ifndef __USE_MALLOC
-using __STD::__default_alloc_template;
+using std::__default_alloc_template;
#endif
-using __STD::alloc;
-using __STD::single_client_alloc;
-#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG
-using __STD::__malloc_alloc_oom_handler;
-#endif /* __STL_STATIC_TEMPLATE_MEMBER_BUG */
-#ifdef __STL_USE_STD_ALLOCATORS
-using __STD::allocator;
-#endif /* __STL_USE_STD_ALLOCATORS */
-
-#endif /* __STL_USE_NAMESPACES */
+using std::alloc;
+using std::single_client_alloc;
+using std::allocator;
#endif /* _CPP_BACKWARD_ALLOC_H */
#ifndef _CPP_BACKWARD_BVECTOR_H
#define _CPP_BACKWARD_BVECTOR_H 1
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
#include "vector.h"
-#else
-#include "algobase.h"
-#include "alloc.h"
-#endif
#include <bits/stl_bvector.h>
-#ifdef __STL_USE_NAMESPACES
-
-using __STD::bit_vector;
-
-#endif /* __STL_USE_NAMESPACES */
+using std::bit_vector;
#endif /* _CPP_BACKWARD_BVECTOR_H */
#include "alloc.h"
#include <bits/std_deque.h>
-#ifdef __STL_USE_NAMESPACES
-using __STD::deque;
-#endif /* __STL_USE_NAMESPACES */
+using std::deque;
#endif /* _CPP_BACKWARD_DEQUE_H */
#include <bits/stl_function.h>
#endif
-#ifdef __STL_USE_NAMESPACES
-
// Names from stl_function.h
-using __STD::unary_function;
-using __STD::binary_function;
-using __STD::plus;
-using __STD::minus;
-using __STD::multiplies;
-using __STD::divides;
-using __STD::identity_element;
-using __STD::modulus;
-using __STD::negate;
-using __STD::equal_to;
-using __STD::not_equal_to;
-using __STD::greater;
-using __STD::less;
-using __STD::greater_equal;
-using __STD::less_equal;
-using __STD::logical_and;
-using __STD::logical_or;
-using __STD::logical_not;
-using __STD::unary_negate;
-using __STD::binary_negate;
-using __STD::not1;
-using __STD::not2;
-using __STD::binder1st;
-using __STD::binder2nd;
-using __STD::bind1st;
-using __STD::bind2nd;
-using __STD::unary_compose;
-using __STD::binary_compose;
-using __STD::compose1;
-using __STD::compose2;
-using __STD::pointer_to_unary_function;
-using __STD::pointer_to_binary_function;
-using __STD::ptr_fun;
-using __STD::identity;
-using __STD::select1st;
-using __STD::select2nd;
-using __STD::project1st;
-using __STD::project2nd;
-using __STD::constant_void_fun;
-using __STD::constant_unary_fun;
-using __STD::constant_binary_fun;
-using __STD::constant0;
-using __STD::constant1;
-using __STD::constant2;
-using __STD::subtractive_rng;
-using __STD::mem_fun_t;
-using __STD::const_mem_fun_t;
-using __STD::mem_fun_ref_t;
-using __STD::const_mem_fun_ref_t;
-using __STD::mem_fun1_t;
-using __STD::const_mem_fun1_t;
-using __STD::mem_fun1_ref_t;
-using __STD::const_mem_fun1_ref_t;
-using __STD::mem_fun;
-using __STD::mem_fun_ref;
-using __STD::mem_fun1;
-using __STD::mem_fun1_ref;
-
-#endif /* __STL_USE_NAMESPACES */
+using std::unary_function;
+using std::binary_function;
+using std::plus;
+using std::minus;
+using std::multiplies;
+using std::divides;
+using std::identity_element;
+using std::modulus;
+using std::negate;
+using std::equal_to;
+using std::not_equal_to;
+using std::greater;
+using std::less;
+using std::greater_equal;
+using std::less_equal;
+using std::logical_and;
+using std::logical_or;
+using std::logical_not;
+using std::unary_negate;
+using std::binary_negate;
+using std::not1;
+using std::not2;
+using std::binder1st;
+using std::binder2nd;
+using std::bind1st;
+using std::bind2nd;
+using std::unary_compose;
+using std::binary_compose;
+using std::compose1;
+using std::compose2;
+using std::pointer_to_unary_function;
+using std::pointer_to_binary_function;
+using std::ptr_fun;
+using std::identity;
+using std::select1st;
+using std::select2nd;
+using std::project1st;
+using std::project2nd;
+using std::constant_void_fun;
+using std::constant_unary_fun;
+using std::constant_binary_fun;
+using std::constant0;
+using std::constant1;
+using std::constant2;
+using std::subtractive_rng;
+using std::mem_fun_t;
+using std::const_mem_fun_t;
+using std::mem_fun_ref_t;
+using std::const_mem_fun_ref_t;
+using std::mem_fun1_t;
+using std::const_mem_fun1_t;
+using std::mem_fun1_ref_t;
+using std::const_mem_fun1_ref_t;
+using std::mem_fun;
+using std::mem_fun_ref;
+using std::mem_fun1;
+using std::mem_fun1_ref;
#endif /* _CPP_BACKWARD_FUNCTION_H */
#include "algobase.h"
#include <bits/stl_hash_map.h>
-#ifdef __STL_USE_NAMESPACES
-using __STD::hash;
-using __STD::hashtable;
-using __STD::hash_map;
-using __STD::hash_multimap;
-#endif /* __STL_USE_NAMESPACES */
-
+using std::hash;
+using std::hashtable;
+using std::hash_map;
+using std::hash_multimap;
#endif /* _CPP_BACKWARD_HASH_MAP_H */
#include "algobase.h"
#include <bits/stl_hash_set.h>
-#ifdef __STL_USE_NAMESPACES
-using __STD::hash;
-using __STD::hashtable;
-using __STD::hash_set;
-using __STD::hash_multiset;
-#endif /* __STL_USE_NAMESPACES */
+using std::hash;
+using std::hashtable;
+using std::hash_set;
+using std::hash_multiset;
#endif /* _CPP_BACKWARD_HASH_SET_H */
#include "alloc.h"
#include "vector.h"
-#ifdef __STL_USE_NAMESPACES
-using __STD::hash;
-using __STD::hashtable;
-#endif /* __STL_USE_NAMESPACES */
+using std::hash;
+using std::hashtable;
#endif /* _CPP_BACKWARD_HASHTABLE_H */
#include <bits/c++config.h>
#include <bits/stl_heap.h>
-#ifdef __STL_USE_NAMESPACES
-
-using __STD::push_heap;
-using __STD::pop_heap;
-using __STD::make_heap;
-using __STD::sort_heap;
-
-#endif /* __STL_USE_NAMESPACES */
-
+using std::push_heap;
+using std::pop_heap;
+using std::make_heap;
+using std::sort_heap;
#endif /* _CPP_BACKWARD_HEAP_H */
#include <bits/stl_raw_storage_iter.h>
#endif
-#ifdef __STL_USE_NAMESPACES
-
// Names from stl_iterator.h
-using __STD::input_iterator_tag;
-using __STD::output_iterator_tag;
-using __STD::forward_iterator_tag;
-using __STD::bidirectional_iterator_tag;
-using __STD::random_access_iterator_tag;
+using std::input_iterator_tag;
+using std::output_iterator_tag;
+using std::forward_iterator_tag;
+using std::bidirectional_iterator_tag;
+using std::random_access_iterator_tag;
#if 0
-using __STD::iterator;
+using std::iterator;
#endif
-using __STD::input_iterator;
-using __STD::output_iterator;
-using __STD::forward_iterator;
-using __STD::bidirectional_iterator;
-using __STD::random_access_iterator;
+using std::input_iterator;
+using std::output_iterator;
+using std::forward_iterator;
+using std::bidirectional_iterator;
+using std::random_access_iterator;
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-using __STD::iterator_traits;
-#endif
+using std::iterator_traits;
-using __STD::iterator_category;
-using __STD::distance_type;
-using __STD::value_type;
+using std::iterator_category;
+using std::distance_type;
+using std::value_type;
-using __STD::distance;
-using __STD::advance;
+using std::distance;
+using std::advance;
-using __STD::insert_iterator;
-using __STD::front_insert_iterator;
-using __STD::back_insert_iterator;
-using __STD::inserter;
-using __STD::front_inserter;
-using __STD::back_inserter;
+using std::insert_iterator;
+using std::front_insert_iterator;
+using std::back_insert_iterator;
+using std::inserter;
+using std::front_inserter;
+using std::back_inserter;
-using __STD::reverse_iterator;
-using __STD::reverse_bidirectional_iterator;
+using std::reverse_iterator;
+using std::reverse_bidirectional_iterator;
-using __STD::istream_iterator;
-using __STD::ostream_iterator;
+using std::istream_iterator;
+using std::ostream_iterator;
// Names from stl_construct.h
-using __STD::construct;
-using __STD::destroy;
+using std::construct;
+using std::destroy;
// Names from stl_raw_storage_iter.h
-using __STD::raw_storage_iterator;
-
-#endif /* __STL_USE_NAMESPACES */
+using std::raw_storage_iterator;
#endif /* _CPP_BACKWARD_ITERATOR_H */
#include "alloc.h"
#include <bits/std_list.h>
-#ifdef __STL_USE_NAMESPACES
-using __STD::list;
-#endif /* __STL_USE_NAMESPACES */
+using std::list;
#endif /* _CPP_BACKWARD_LIST_H */
#include "tree.h"
#include <bits/stl_map.h>
-#ifdef __STL_USE_NAMESPACES
-using __STD::map;
-#endif /* __STL_USE_NAMESPACES */
+using std::map;
#endif /* _CPP_BACKWARD_MAP_H */
#include "tree.h"
#include <bits/stl_multimap.h>
-#ifdef __STL_USE_NAMESPACES
-using __STD::multimap;
-#endif /* __STL_USE_NAMESPACES */
+using std::multimap;
#endif /* _CPP_BACKWARD_MULTIMAP_H */
#include "tree.h"
#include <bits/stl_multiset.h>
-#ifdef __STL_USE_NAMESPACES
-using __STD::multiset;
-#endif /* __STL_USE_NAMESPACES */
+using std::multiset;
#endif /* _CPP_BACKWARD_MULTISET_H */
#include <bits/stl_pair.h>
#endif
-#ifdef __STL_USE_NAMESPACES
-
-using __STD::pair;
-using __STD::make_pair;
-
-#endif /* __STL_USE_NAMESPACES */
+using std::pair;
+using std::make_pair;
#endif /* _CPP_BACKWARD_PAIR_H */
#include "hashtable.h"
#include <bits/stl_rope.h>
-#ifdef __STL_USE_NAMESPACES
-
-using __STD::char_producer;
-using __STD::sequence_buffer;
-using __STD::rope;
-using __STD::crope;
-using __STD::wrope;
-
-#endif /* __STL_USE_NAMESPACES */
+using std::char_producer;
+using std::sequence_buffer;
+using std::rope;
+using std::crope;
+using std::wrope;
#endif /* _CPP_BACKWARD_ROPE_H */
#include "tree.h"
#include <bits/stl_set.h>
-#ifdef __STL_USE_NAMESPACES
-using __STD::set;
-#endif /* __STL_USE_NAMESPACES */
+using std::set;
#endif /* _CPP_BACKWARD_SET_H */
#include <ext/slist>
-#ifdef __STL_USE_NAMESPACES
-using __STD::slist;
-#endif /* __STL_USE_NAMESPACES */
+using std::slist;
#endif /* _CPP_BACKWARD_SLIST_H */
#include <bits/stl_stack.h>
#include <bits/stl_queue.h>
-#ifdef __STL_USE_NAMESPACES
-using __STD::stack;
-using __STD::queue;
-using __STD::priority_queue;
-#endif /* __STL_USE_NAMESPACES */
+using std::stack;
+using std::queue;
+using std::priority_queue;
#endif /* _CPP_BACKWARD_STACK_H */
#include <bits/std_ostream.h>
#include <bits/std_string.h>
-__STL_BEGIN_NAMESPACE
+namespace std
+{
//----------------------------------------------------------------------
// Class strstreambuf, a streambuf class that manages an array of char.
strstreambuf _M_buf;
};
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_STRSTREAM */
#include <bits/stl_tempbuf.h>
#endif
-#ifdef __STL_USE_NAMESPACES
-
-using __STD::get_temporary_buffer;
-using __STD::return_temporary_buffer;
-using __STD::_Temporary_buffer;
-
-#endif /* __STL_USE_NAMESPACES */
+using std::get_temporary_buffer;
+using std::return_temporary_buffer;
+using std::_Temporary_buffer;
#endif /* _CPP_BACKWARD_TEMPBUF_H */
#include "algobase.h"
#include "alloc.h"
-#ifdef __STL_USE_NAMESPACES
-using __STD::rb_tree;
-#endif /* __STL_USE_NAMESPACES */
+using std::rb_tree;
#endif /* _CPP_BACKWARD_TREE_H */
#include "alloc.h"
#include <bits/stl_vector.h>
-#ifdef __STL_USE_NAMESPACES
-using __STD::vector;
-#endif /* __STL_USE_NAMESPACES */
+using std::vector;
#endif /* _CPP_BACKWARD_VECTOR_H */
#endif /* _CPP_BITS_BASICIOS_H */
-
-
-
-
-
-
#endif /* _CPP_BITS_BASICIOS_TCC */
-
-
-
#include <bits/atomicity.h>
-namespace std {
+namespace std
+{
// Documentation? What's that?
// Nathan Myers <ncm@cantrip.org>.
// Use corrected code from the committee library group's issues list.
#define _GLIBCPP_RESOLVE_LIB_DEFECTS 1
-
// From SGI's stl_config.h; generic settings and user hooks (_NOTHREADS).
#if defined(_PTHREADS) && !defined(_NOTHREADS)
# define __STL_PTHREADS
# define __STL_UITHREADS
#endif
-// Also from SGI's stl_config.h; settings for GCC.
-#define __STL_HAS_WCHAR_T
-#define __STL_MEMBER_TEMPLATES
-#define __STL_MEMBER_TEMPLATE_CLASSES
-#define __STL_TEMPLATE_FRIENDS
-#define __STL_CLASS_PARTIAL_SPECIALIZATION
-#define __STL_PARTIAL_SPECIALIZATION_SYNTAX
-#define __STL_FUNCTION_TMPL_PARTIAL_ORDER
-#define __STL_EXPLICIT_FUNCTION_TMPL_ARGS
-#define __SGI_STL_USE_AUTO_PTR_CONVERSIONS
-#define __STL_HAS_NAMESPACES
-#define __STL_USE_NAMESPACES
+// Concept-checking code is on by default unless users define
+// the _STL_NO_CONCEPT_CHECKS hook.
+#if !defined(_STL_NO_CONCEPT_CHECKS)
+# define __STL_USE_CONCEPT_CHECKS
+#endif
+
+// This is also a user hook, but via -f[no-]exceptions, not direct #defines.
#ifdef __EXCEPTIONS
# define __STL_USE_EXCEPTIONS
# define __STL_TRY try
# define __STL_NOTHROW
# define __STL_UNWIND(action)
#endif
-#define __STL_THROW_RANGE_ERRORS
-#define __STL_CAN_THROW_RANGE_ERRORS
-#define __STL_USE_STD_ALLOCATORS
-#define __USE_MALLOC // As the "underlying allocator"
-//#define __STL_USE_NEW_IOSTREAMS //990209 bkoz--use standard .h includes.
+
+// This is the "underlying allocator"
+#define __USE_MALLOC
+
+// Define this to permit user-level control of the expansion of string
+// buffers (via a fn pointer), see basic_string.* for more.
+//#define _GLIBCPP_ALLOC_CONTROL
+
+// The remainder of the prewritten config is mostly automatic; all the
+// user hooks are listed above.
+
#ifdef _REENTRANT
# define __STL_THREADS
#endif
#ifdef _PTHREADS
# define __STL_PTHREADS
#endif
-#ifndef __STRICT_ANSI__
-# define __STL_LONG_LONG
-#endif
+//#ifndef __STRICT_ANSI__
+//# define __STL_LONG_LONG
+//#endif
+
+// 20010302 pme -- this is only used in bits/concept_checks.h
//#if (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR__ < 95)
# define __STL_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE
//#endif
-// Also from SGI's stl_config.h; settings for GCC.
-// Mingw32, GCC compiler using the Microsoft C runtime
+// Mingw32, GCC compiler using the Microsoft C runtime (settings taken from
+// SGI's stl_config.h)
#if defined(__MINGW32__)
# define __STL_NO_DRAND48
# ifdef _MT
# endif
#endif
-// Cygwin32, GCC compiler on MS Windows
+// Cygwin32, GCC compiler on MS Windows (settings taken from SGI's
+// stl_config.h)
#if defined(__CYGWIN__)
# define __STL_NO_DRAND48
#endif
-// The old stl_config.h would use the above settings in chains of
-// if/then/else tests to define the following.
-#define __STL_DEPENDENT_DEFAULT_TMPL(_Tp) = _Tp
-#define __STL_TEMPLATE
-#define __STL_NULL_TMPL_ARGS <>
-#define __STL_TEMPLATE_NULL template<>
-#define __STL_DEFAULT_ALLOCATOR(T) allocator< T >
-
-#define __STL_USE_NAMESPACES
-#define __STD std
-#define __STL_BEGIN_NAMESPACE namespace std {
-#define __STL_END_NAMESPACE }
-#define __STL_USE_NAMESPACE_FOR_RELOPS
-#define __STL_BEGIN_RELOPS_NAMESPACE namespace std { namespace rel_ops {
-#define __STL_END_RELOPS_NAMESPACE } }
-#define __STD_RELOPS std::rel_ops
-#define __STD_QUALIFIER std::
-
-
+// XXX Only used in the SGI rope extensions; this is from stl_config.h and
+// should be cleaned up.
#ifdef __STL_ASSERTIONS
# include <stdio.h>
# define __stl_assert(expr) \
# define __stl_assert(expr)
#endif
+
#if defined(__STL_WIN32THREADS) || defined(__STL_SGI_THREADS) \
|| defined(__STL_PTHREADS) || defined(__STL_UITHREADS)
# define __STL_THREADS
# define __STL_VOLATILE
#endif
-#if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) \
- && defined(__STL_MEMBER_TEMPLATES) \
- && !defined(_STL_NO_CONCEPT_CHECKS)
-# define __STL_USE_CONCEPT_CHECKS
-#endif
-
// End of prewritten config; the discovered settings follow.
/* Associated Type Requirements */
-__STL_BEGIN_NAMESPACE
+namespace std
+{
template <class _Iterator> struct iterator_traits;
-__STL_END_NAMESPACE
+} // namespace std
template <class _Iter>
struct __value_type_type_definition_requirement_violation {
- typedef typename __STD::iterator_traits<_Iter>::value_type value_type;
+ typedef typename std::iterator_traits<_Iter>::value_type value_type;
};
template <class _Iter>
struct __difference_type_type_definition_requirement_violation {
- typedef typename __STD::iterator_traits<_Iter>::difference_type
+ typedef typename std::iterator_traits<_Iter>::difference_type
difference_type;
};
template <class _Iter>
struct __reference_type_definition_requirement_violation {
- typedef typename __STD::iterator_traits<_Iter>::reference reference;
+ typedef typename std::iterator_traits<_Iter>::reference reference;
};
template <class _Iter>
struct __pointer_type_definition_requirement_violation {
- typedef typename __STD::iterator_traits<_Iter>::pointer pointer;
+ typedef typename std::iterator_traits<_Iter>::pointer pointer;
};
template <class _Iter>
struct __iterator_category_type_definition_requirement_violation {
- typedef typename __STD::iterator_traits<_Iter>::iterator_category
+ typedef typename std::iterator_traits<_Iter>::iterator_category
iterator_category;
};
__pointer__typedef_requirement_violation<_Alloc>();
__const_pointer__typedef_requirement_violation<_Alloc>();
typedef typename _Alloc::value_type _Tp;
- //__STL_REQUIRES_SAME_TYPE(typename _Alloc::__STL_TEMPLATE rebind<_Tp>::other,
- // _Alloc);
+// __STL_REQUIRES_SAME_TYPE(typename _Alloc::template rebind<_Tp>::other, _Alloc);
}
};
// not have included the std_ios file.
#include <bits/c++io.h>
-namespace std {
+namespace std
+{
// 27.4.1 Types
#endif // _CPP_BITS_FSTREAM_TCC
-
-
-
-
-
-
-
-
void
__throw_ios_failure(const char* __s);
} // namespace std
+
#pragma GCC system_header
-namespace std {
+namespace std
+{
// The following definitions of bitmask types are enums, not ints,
// as permitted (but not required) in the standard, in order to provide
#endif /* _CPP_BITS_IOSBASE_H */
-
-
-
-
-
-
-
-
// mode:C++
// End:
-
-
-
-
-
-
-
-
-
-
-
-
-
// The template and inlines for the -*- C++ -*- mask_array class.
-// Copyright (C) 1997-2001, 2000 Free Software Foundation, Inc.
+// Copyright (C) 1997-2001 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
// mode:C++
// End:
-
-
-
-
-
-
-
-
-
# define __RESTRICT
#endif
-#ifndef __STL_NO_BAD_ALLOC
-# include <new>
-#endif
+#include <new>
-__STL_BEGIN_NAMESPACE
+namespace std
+{
#define __STL_DATA_ALIGNMENT 8
_Pthread_alloc_per_thread_state<_Max_size> * __result;
if (!_S_key_initialized) {
if (pthread_key_create(&_S_key, _S_destructor)) {
- __THROW_BAD_ALLOC; // defined in stl_alloc.h
+ std::__throw_bad_alloc(); // defined in funcexcept.h
}
_S_key_initialized = true;
}
__ret_code = pthread_setspecific(_S_key, __result);
if (__ret_code) {
if (__ret_code == ENOMEM) {
- __THROW_BAD_ALLOC;
+ std::__throw_bad_alloc();
} else {
// EINVAL
abort();
size_t _Pthread_alloc_template<_Max_size>
::_S_heap_size = 0;
-#ifdef __STL_USE_STD_ALLOCATORS
template <class _Tp>
class pthread_allocator {
};
-#endif /* __STL_USE_STD_ALLOCATORS */
-
-__STL_END_NAMESPACE
+} // namespace std
#endif /* _CPP_BITS_PTHREAD_ALLOCIMPL_H */
#endif /* _CPP_BITS_SBUF_ITER_H */
-
-
-
-
-
-
-
-
-
-
-
-
-
-
// The template and inlines for the -*- C++ -*- slice class.
-// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+// Copyright (C) 1997-1999, 2001 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
#pragma GCC system_header
-namespace std {
+namespace std
+{
class slice
{
// The template and inlines for the -*- C++ -*- slice_array class.
-// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
+// Copyright (C) 1997-1999, 2000, 2001 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
#pragma GCC system_header
-namespace std {
+namespace std
+{
template<typename _Tp>
class slice_array
// String based streams -*- C++ -*-
-// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+// Copyright (C) 1997-1999, 2001 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
#include <bits/std_sstream.h>
-namespace std {
+namespace std
+{
template <class _CharT, class _Traits, class _Alloc>
basic_stringbuf<_CharT, _Traits, _Alloc>::int_type
#endif /* _CPP_BITS_SSTREAM_TCC */
-
-
-
-
-
-
-
-
#include <bits/std_stdexcept.h> // for invalid_argument, out_of_range,
// overflow_error
-#ifdef __STL_USE_NEW_IOSTREAMS
-#include <iostream>
-#else
#include <bits/std_iostream.h> // for istream, ostream
-#endif
#define _GLIBCPP_BITSET_BITS_PER_WORD (CHAR_BIT*sizeof(unsigned long))
#define __BITSET_WORDS(__n) \
((__n) < 1 ? 1 : ((__n) + _GLIBCPP_BITSET_BITS_PER_WORD - 1)/_GLIBCPP_BITSET_BITS_PER_WORD)
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1209
-#endif
+namespace std
+{
// structure to aid in counting bits
template<bool __dummy>
// Base class: specialization for a single word.
//
-__STL_TEMPLATE_NULL struct _Base_bitset<1> {
+template<> struct _Base_bitset<1> {
typedef unsigned long _WordT;
_WordT _M_w;
{ __val &= ~((~static_cast<unsigned long>(0)) << _Extrabits); }
};
-__STL_TEMPLATE_NULL struct _Sanitize<0> {
+template<> struct _Sanitize<0> {
static void _M_do_sanitize(unsigned long) {}
};
bitset(unsigned long __val) : _Base_bitset<__BITSET_WORDS(_Nb)>(__val)
{ _M_do_sanitize(); }
-#ifdef __STL_MEMBER_TEMPLATES
template<class _CharT, class _Traits, class _Alloc>
explicit bitset(const basic_string<_CharT, _Traits, _Alloc>& __s,
size_t __pos = 0)
__STL_THROW(out_of_range("bitset"));
_M_copy_from_string(__s, __pos, __n);
}
-#else /* __STL_MEMBER_TEMPLATES */
- explicit bitset(const basic_string<char>& __s,
- size_t __pos = 0,
- size_t __n = basic_string<char>::npos)
- : _Base()
- {
- if (__pos > __s.size())
- __STL_THROW(out_of_range("bitset"));
- _M_copy_from_string(__s, __pos, __n);
- }
-#endif /* __STL_MEMBER_TEMPLATES */
// 23.3.5.2 bitset operations:
bitset<_Nb>& operator&=(const bitset<_Nb>& __rhs) {
unsigned long to_ulong() const { return this->_M_do_to_ulong(); }
-#if defined(__STL_MEMBER_TEMPLATES) && \
- defined(__STL_EXPLICIT_FUNCTION_TMPL_ARGS)
template <class _CharT, class _Traits, class _Alloc>
basic_string<_CharT, _Traits, _Alloc> to_string() const {
basic_string<_CharT, _Traits, _Alloc> __result;
_M_copy_to_string(__result);
return __result;
}
-#endif /* member templates and explicit function template args */
// Helper functions for string operations.
-#ifdef __STL_MEMBER_TEMPLATES
template<class _CharT, class _Traits, class _Alloc>
void _M_copy_from_string(const basic_string<_CharT,_Traits,_Alloc>& __s,
size_t,
template<class _CharT, class _Traits, class _Alloc>
void _M_copy_to_string(basic_string<_CharT,_Traits,_Alloc>&) const;
-#else /* __STL_MEMBER_TEMPLATES */
- void _M_copy_from_string(const basic_string<char>&, size_t, size_t);
- void _M_copy_to_string(basic_string<char>&) const;
-#endif /* __STL_MEMBER_TEMPLATES */
size_t count() const { return this->_M_do_count(); }
// Definitions of non-inline member functions.
//
-#ifdef __STL_MEMBER_TEMPLATES
-
template <size_t _Nb>
template<class _CharT, class _Traits, class _Alloc>
void bitset<_Nb>
__s[_Nb - 1 - __i] = '1';
}
-#else /* __STL_MEMBER_TEMPLATES */
-
-template <size_t _Nb>
-void bitset<_Nb>::_M_copy_from_string(const basic_string<char>& __s,
- size_t __pos, size_t __n)
-{
- reset();
- size_t __tmp = _Nb;
- const size_t __nbits = min(__tmp, min(__n, __s.size() - __pos));
- for (size_t __i = 0; __i < __nbits; ++__i) {
- switch(__s[__pos + __nbits - __i - 1]) {
- case '0':
- break;
- case '1':
- set(__i);
- break;
- default:
- __STL_THROW(invalid_argument("bitset"));
- }
- }
-}
-
-template <size_t _Nb>
-void bitset<_Nb>::_M_copy_to_string(basic_string<char>& __s) const
-{
- __s.assign(_Nb, '0');
-
- for (size_t __i = 0; __i < _Nb; ++__i)
- if (_Unchecked_test(__i))
- __s[_Nb - 1 - __i] = '1';
-}
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
// ------------------------------------------------------------
//
return __result;
}
-#ifdef __STL_USE_NEW_IOSTREAMS
-
template <class _CharT, class _Traits, size_t _Nb>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x)
if (__sentry) {
basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf();
for (size_t __i = 0; __i < _Nb; ++__i) {
- static _Traits::int_type __eof = _Traits::eof();
+ static typename _Traits::int_type __eof = _Traits::eof();
typename _Traits::int_type __c1 = __buf->sbumpc();
if (_Traits::eq_int_type(__c1, __eof)) {
return __os << __tmp;
}
-#else /* __STL_USE_NEW_IOSTREAMS */
-
-template <size_t _Nb>
-istream& operator>>(istream& __is, bitset<_Nb>& __x) {
- string __tmp;
- __tmp.reserve(_Nb);
-
- if (__is.flags() & ios::skipws) {
- char __c;
- do
- __is.get(__c);
- while (__is && isspace(__c));
- if (__is)
- __is.putback(__c);
- }
-
- for (size_t __i = 0; __i < _Nb; ++__i) {
- char __c;
- __is.get(__c);
-
- if (!__is)
- break;
- else if (__c != '0' && __c != '1') {
- __is.putback(__c);
- break;
- }
- else
- __tmp.push_back(__c);
- }
-
- if (__tmp.empty())
- __is.clear(__is.rdstate() | ios::failbit);
- else
- __x._M_copy_from_string(__tmp, static_cast<size_t>(0), _Nb);
-
- return __is;
-}
-
-template <size_t _Nb>
-ostream& operator<<(ostream& __os, const bitset<_Nb>& __x) {
- string __tmp;
- __x._M_copy_to_string(__tmp);
- return __os << __tmp;
-}
-
-#endif /* __STL_USE_NEW_IOSTREAMS */
-
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1209
-#endif
-
-__STL_END_NAMESPACE
+} // namespace std
#undef __BITSET_WORDS
#endif /* _CPP_FSTREAM */
-
-
-
-
-
// Standard stream manipulators -*- C++ -*-
-// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+// Copyright (C) 1997-1999, 2001 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
#include <bits/std_istream.h>
#include <bits/std_functional.h>
-namespace std {
+namespace std
+{
struct _Resetiosflags { ios_base::fmtflags _M_mask; };
#endif /* __IOMANIP */
-
-
-
-
#endif /* _CPP_IOS */
-
-
-
-
// Input streams -*- C++ -*-
-// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+// Copyright (C) 1997-1999, 2001 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
#include <bits/std_ios.h>
#include <bits/std_limits.h> // For numeric_limits
-namespace std {
+namespace std
+{
// 27.6.1.1 Template class basic_istream
template<typename _CharT, typename _Traits>
#endif /* _CPP_ISTREAM */
-
-
-
-
-
-
-
// mode:C++
// End:
-
-
-
-
#include <bits/stl_uninitialized.h>
#include <bits/stl_raw_storage_iter.h>
-__STL_BEGIN_NAMESPACE
+namespace std
+{
-#if defined(__SGI_STL_USE_AUTO_PTR_CONVERSIONS) && \
- defined(__STL_MEMBER_TEMPLATES)
-
template<class _Tp1> struct auto_ptr_ref {
_Tp1* _M_ptr;
auto_ptr_ref(_Tp1* __p) : _M_ptr(__p) {}
};
-#endif
-
template <class _Tp> class auto_ptr {
private:
_Tp* _M_ptr;
explicit auto_ptr(_Tp* __p = 0) __STL_NOTHROW : _M_ptr(__p) {}
auto_ptr(auto_ptr& __a) __STL_NOTHROW : _M_ptr(__a.release()) {}
-#ifdef __STL_MEMBER_TEMPLATES
template <class _Tp1> auto_ptr(auto_ptr<_Tp1>& __a) __STL_NOTHROW
: _M_ptr(__a.release()) {}
-#endif /* __STL_MEMBER_TEMPLATES */
auto_ptr& operator=(auto_ptr& __a) __STL_NOTHROW {
reset(__a.release());
return *this;
}
-#ifdef __STL_MEMBER_TEMPLATES
template <class _Tp1>
auto_ptr& operator=(auto_ptr<_Tp1>& __a) __STL_NOTHROW {
reset(__a.release());
return *this;
}
-#endif /* __STL_MEMBER_TEMPLATES */
// Note: The C++ standard says there is supposed to be an empty throw
// specification here, but omitting it is standard conforming. Its
// present-day compilers, however, do not enforce that requirement---and,
// in fact, most present-day compilers do not support the language
// features that these conversions rely on.
-
-#if defined(__SGI_STL_USE_AUTO_PTR_CONVERSIONS) && \
- defined(__STL_MEMBER_TEMPLATES)
-
public:
auto_ptr(auto_ptr_ref<_Tp> __ref) __STL_NOTHROW
: _M_ptr(__ref._M_ptr) {}
{ return auto_ptr_ref<_Tp>(this->release()); }
template <class _Tp1> operator auto_ptr<_Tp1>() __STL_NOTHROW
{ return auto_ptr<_Tp1>(this->release()); }
-
-#endif /* auto ptr conversions && member templates */
};
-__STL_END_NAMESPACE
+} // namespace std
#endif /* _CPP_MEMORY */
#include <bits/std_ios.h>
-namespace std {
-
+namespace std
+{
// 27.6.2.1 Template class basic_ostream
template<typename _CharT, typename _Traits>
class basic_ostream : virtual public basic_ios<_CharT, _Traits>
#include <bits/std_istream.h>
#include <bits/std_ostream.h>
-namespace std {
-
+namespace std
+{
template<typename _CharT, typename _Traits, typename _Alloc>
class basic_stringbuf : public basic_streambuf<_CharT, _Traits>
{
#endif
#endif
-
#endif /* _CPP_SSTREAM */
-
-
-
-
-
-
-
-
-
-
-
-
-
#include <bits/localefwd.h>
#include <bits/ios_base.h>
-namespace std {
-
+namespace std
+{
template<typename _CharT, typename _Traits>
streamsize
__copy_streambufs(basic_ios<_CharT, _Traits>& _ios,
#endif /* _CPP_STREAMBUF */
-
-
-
-
-
-
-
-
-
-
#endif /* _CPP_STRING */
-
-
-
-
-
-
-
-
-
-
-
-
// The template and inlines for the -*- C++ -*- valarray class.
-// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
+// Copyright (C) 1997-1999, 2000, 2001 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
#include <bits/std_functional.h>
#include <bits/std_algorithm.h>
-namespace std {
-
+namespace std
+{
template<class _Clos, typename _Tp> class _Expr;
template<typename _Tp1, typename _Tp2> class _ValArray;
template<class _Tp> class mask_array; // masked array
template<class _Tp> class indirect_array; // indirected array
-}
+} // namespace std
#include <bits/valarray_array.h>
#include <bits/valarray_meta.h>
-namespace std {
-
+namespace std
+{
template<class _Tp> class valarray
{
public:
#include <bits/mask_array.h>
#include <bits/indirect_array.h>
-namespace std {
-
+namespace std
+{
template<typename _Tp>
inline valarray<_Tp>::valarray () : _M_size (0), _M_data (0) {}
} // std::
-namespace std {
+namespace std
+{
#define _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(_Op, _Name) \
template<class _Tp> template<class _Dom> \
// See concept_checks.h for the concept-checking macros
// __STL_REQUIRES, __STL_CONVERTIBLE, etc.
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1209
-#endif
+namespace std
+{
// __median (an extension, not present in the C++ standard).
return __first;
}
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
template <class _RandomAccessIter, class _Tp>
_RandomAccessIter find(_RandomAccessIter __first, _RandomAccessIter __last,
const _Tp& __val,
}
}
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
template <class _InputIter, class _Tp>
inline _InputIter find(_InputIter __first, _InputIter __last,
const _Tp& __val)
++__n;
}
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
template <class _InputIter, class _Tp>
typename iterator_traits<_InputIter>::difference_type
count(_InputIter __first, _InputIter __last, const _Tp& __value) {
}
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
// search.
template <class _ForwardIter1, class _ForwardIter2>
}
// find_end for bidirectional iterators. Requires partial specialization.
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
template <class _BidirectionalIter1, class _BidirectionalIter2>
_BidirectionalIter1
__find_end(_BidirectionalIter1 __first1, _BidirectionalIter1 __last1,
return __result;
}
}
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
// Dispatching functions for find_end.
return true;
}
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1209
-#endif
-
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_ALGO_H */
#include <bits/std_cstddef.h>
#include <new>
-#ifdef __STL_USE_NEW_IOSTREAMS
-#include <iosfwd>
-#else /* __STL_USE_NEW_IOSTREAMS */
#include <bits/std_iosfwd.h>
-#endif /* __STL_USE_NEW_IOSTREAMS */
-
#include <bits/stl_iterator_base.h>
#include <bits/stl_iterator.h>
// We pick up concept_checks.h from stl_iterator_base.h.
-__STL_BEGIN_NAMESPACE
+namespace std
+{
// swap and iter_swap
//--------------------------------------------------
// min and max
-#if !defined(__BORLANDC__) || __BORLANDC__ >= 0x540 /* C++ Builder 4.0 */
-
#undef min
#undef max
if (__a < __b) return __b; return __a;
}
-#endif /* __BORLANDC__ */
-
template <class _Tp, class _Compare>
inline const _Tp& min(const _Tp& __a, const _Tp& __b, _Compare __comp) {
//return __comp(__b, __a) ? __b : __a;
return __result + (__last - __first);
}
-#if defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER)
template <class _InputIter, class _OutputIter>
inline _OutputIter __copy_aux2(_InputIter __first, _InputIter __last,
return __copy_ni1(__first, __last, __result, __Normal());
}
-// Hack for compilers that don't have partial ordering of function templates
-// but do have partial specialization of class templates.
-#elif defined(__STL_CLASS_PARTIAL_SPECIALIZATION)
-
-template <class _InputIter, class _OutputIter, class _BoolType>
-struct __copy_dispatch {
- static _OutputIter copy(_InputIter __first, _InputIter __last,
- _OutputIter __result) {
- typedef typename iterator_traits<_InputIter>::iterator_category _Category;
- typedef typename iterator_traits<_InputIter>::difference_type _Distance;
- return __copy(__first, __last, __result, _Category(), (_Distance*) 0);
- }
-};
-
-template <class _Tp>
-struct __copy_dispatch<_Tp*, _Tp*, __true_type>
-{
- static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) {
- return __copy_trivial(__first, __last, __result);
- }
-};
-
-template <class _Tp>
-struct __copy_dispatch<const _Tp*, _Tp*, __true_type>
-{
- static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) {
- return __copy_trivial(__first, __last, __result);
- }
-};
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter copy(_InputIter __first, _InputIter __last,
- _OutputIter __result) {
- __STL_REQUIRES(_InputIter, _InputIterator);
- __STL_REQUIRES(_OutputIter, _OutputIterator);
- typedef typename iterator_traits<_InputIter>::value_type _Tp;
- typedef typename __type_traits<_Tp>::has_trivial_assignment_operator
- _Trivial;
- return __copy_dispatch<_InputIter, _OutputIter, _Trivial>
- ::copy(__first, __last, __result);
-}
-
-// Fallback for compilers with neither partial ordering nor partial
-// specialization. Define the faster version for the basic builtin
-// types.
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter copy(_InputIter __first, _InputIter __last,
- _OutputIter __result)
-{
- return __copy(__first, __last, __result,
- __ITERATOR_CATEGORY(__first),
- __DISTANCE_TYPE(__first));
-}
-
-#define __SGI_STL_DECLARE_COPY_TRIVIAL(_Tp) \
- inline _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) { \
- memmove(__result, __first, sizeof(_Tp) * (__last - __first)); \
- return __result + (__last - __first); \
- }
-
-__SGI_STL_DECLARE_COPY_TRIVIAL(char)
-__SGI_STL_DECLARE_COPY_TRIVIAL(signed char)
-__SGI_STL_DECLARE_COPY_TRIVIAL(unsigned char)
-__SGI_STL_DECLARE_COPY_TRIVIAL(short)
-__SGI_STL_DECLARE_COPY_TRIVIAL(unsigned short)
-__SGI_STL_DECLARE_COPY_TRIVIAL(int)
-__SGI_STL_DECLARE_COPY_TRIVIAL(unsigned int)
-__SGI_STL_DECLARE_COPY_TRIVIAL(long)
-__SGI_STL_DECLARE_COPY_TRIVIAL(unsigned long)
-#ifdef __STL_HAS_WCHAR_T
-__SGI_STL_DECLARE_COPY_TRIVIAL(wchar_t)
-#endif
-#ifdef _STL_LONG_LONG
-__SGI_STL_DECLARE_COPY_TRIVIAL(long long)
-__SGI_STL_DECLARE_COPY_TRIVIAL(unsigned long long)
-#endif
-__SGI_STL_DECLARE_COPY_TRIVIAL(float)
-__SGI_STL_DECLARE_COPY_TRIVIAL(double)
-__SGI_STL_DECLARE_COPY_TRIVIAL(long double)
-
-#undef __SGI_STL_DECLARE_COPY_TRIVIAL
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
//--------------------------------------------------
// copy_backward
return __result;
}
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
// This dispatch class is a workaround for compilers that do not
// have partial ordering of function templates. All we're doing is
__Normal());
}
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _BI1, class _BI2>
-inline _BI2 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) {
- return __copy_backward(__first, __last, __result,
- __ITERATOR_CATEGORY(__first),
- __DISTANCE_TYPE(__first));
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
//--------------------------------------------------
// copy_n (not part of the C++ standard)
memset(__first, static_cast<unsigned char>(__tmp), __last - __first);
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _Size>
inline unsigned char* fill_n(unsigned char* __first, _Size __n,
const unsigned char& __c) {
return __first + __n;
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
//--------------------------------------------------
// equal and mismatch
return __lexicographical_compare_3way(__first1, __last1, __first2, __last2);
}
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_ALGOBASE_H */
#ifndef __SGI_STL_INTERNAL_ALLOC_H
#define __SGI_STL_INTERNAL_ALLOC_H
-#ifdef __SUNPRO_CC
-# define __PRIVATE public
- // Extra access restrictions prevent us from really making some things
- // private.
-#else
-# define __PRIVATE private
-#endif
-
-#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG
-# define __USE_MALLOC
-#endif
-
-
// This implements some standard node allocators. These are
// NOT the same as the allocators in the C++ draft standard or in
// in the original STL. They do not encapsulate different pointer
// The allocation primitives are intended to allocate individual objects,
// not larger arenas as with the original STL allocators.
-#ifndef __THROW_BAD_ALLOC
-# if defined(__STL_NO_BAD_ALLOC) || !defined(__STL_USE_EXCEPTIONS)
-# include <bits/std_cstdio.h>
-# include <bits/std_cstdlib.h>
-# define __THROW_BAD_ALLOC fprintf(stderr, "out of memory\n"); exit(1)
-# else /* Standard conforming out-of-memory handling */
-# include <new>
-# define __THROW_BAD_ALLOC throw std::bad_alloc()
-# endif
-#endif
-
+#include <bits/functexcept.h> // for __throw_bad_alloc
#include <bits/std_cstddef.h>
#include <bits/std_cstdlib.h>
#include <bits/std_cstring.h>
# define __NODE_ALLOCATOR_THREADS false
#endif
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#endif
+namespace std
+{
// Malloc-based allocator. Typically slower than default alloc below.
// Typically thread-safe and more storage efficient.
-#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG
-# ifdef __DECLARE_GLOBALS_HERE
- void (* __malloc_alloc_oom_handler)() = 0;
- // g++ 2.7.2 does not handle static template data members.
-# else
- extern void (* __malloc_alloc_oom_handler)();
-# endif
-#endif
-
template <int __inst>
class __malloc_alloc_template {
static void* _S_oom_malloc(size_t);
static void* _S_oom_realloc(void*, size_t);
-
-#ifndef __STL_STATIC_TEMPLATE_MEMBER_BUG
static void (* __malloc_alloc_oom_handler)();
-#endif
public:
// malloc_alloc out-of-memory handling
-#ifndef __STL_STATIC_TEMPLATE_MEMBER_BUG
template <int __inst>
void (* __malloc_alloc_template<__inst>::__malloc_alloc_oom_handler)() = 0;
-#endif
template <int __inst>
void*
for (;;) {
__my_malloc_handler = __malloc_alloc_oom_handler;
- if (0 == __my_malloc_handler) { __THROW_BAD_ALLOC; }
+ if (0 == __my_malloc_handler) { std::__throw_bad_alloc(); }
(*__my_malloc_handler)();
__result = malloc(__n);
if (__result) return(__result);
for (;;) {
__my_malloc_handler = __malloc_alloc_oom_handler;
- if (0 == __my_malloc_handler) { __THROW_BAD_ALLOC; }
+ if (0 == __my_malloc_handler) { std::__throw_bad_alloc(); }
(*__my_malloc_handler)();
__result = realloc(__p, __n);
if (__result) return(__result);
// Node that containers built on different allocator instances have
// different types, limiting the utility of this approach.
-#if defined(__SUNPRO_CC) || defined(__GNUC__)
-// breaks if we make these template class members:
- enum {_ALIGN = 8};
- enum {_MAX_BYTES = 128};
- enum {_NFREELISTS = 16}; // _MAX_BYTES/_ALIGN
-#endif
-
template <bool threads, int inst>
class __default_alloc_template {
private:
// Really we should use static const int x = N
// instead of enum { x = N }, but few compilers accept the former.
-#if ! (defined(__SUNPRO_CC) || defined(__GNUC__))
- enum {_ALIGN = 8};
- enum {_MAX_BYTES = 128};
- enum {_NFREELISTS = 16}; // _MAX_BYTES/_ALIGN
-# endif
+ enum {_ALIGN = 8};
+ enum {_MAX_BYTES = 128};
+ enum {_NFREELISTS = 16}; // _MAX_BYTES/_ALIGN
static size_t
_S_round_up(size_t __bytes)
{ return (((__bytes) + (size_t) _ALIGN-1) & ~((size_t) _ALIGN - 1)); }
-__PRIVATE:
union _Obj {
union _Obj* _M_free_list_link;
char _M_client_data[1]; /* The client sees this. */
};
-private:
-# if defined(__SUNPRO_CC) || defined(__GNUC__) || defined(__HP_aCC)
- static _Obj* __STL_VOLATILE _S_free_list[];
+
+ static _Obj* __STL_VOLATILE _S_free_list[];
// Specifying a size results in duplicate def for 4.1
-# else
- static _Obj* __STL_VOLATILE _S_free_list[_NFREELISTS];
-# endif
static size_t _S_freelist_index(size_t __bytes) {
return (((__bytes) + (size_t)_ALIGN-1)/(size_t)_ALIGN - 1);
}
return true;
}
-# ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <bool __threads, int __inst>
inline bool operator!=(const __default_alloc_template<__threads, __inst>&,
const __default_alloc_template<__threads, __inst>&)
{
return false;
}
-# endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
template <bool __threads, int __inst>
typename __default_alloc_template<__threads, __inst>::_Obj* __STL_VOLATILE
__default_alloc_template<__threads, __inst> ::_S_free_list[
-# if defined(__SUNPRO_CC) || defined(__GNUC__) || defined(__HP_aCC)
- _NFREELISTS
-# else
__default_alloc_template<__threads, __inst>::_NFREELISTS
-# endif
] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
// The 16 zeros are necessary to make version 4.1 of the SunPro
// compiler happy. Otherwise it appears to allocate too little
// templates, the typename keyword, and the use of the template keyword
// to refer to a template member of a dependent type.
-#ifdef __STL_USE_STD_ALLOCATORS
-
template <class _Tp>
class allocator {
typedef alloc _Alloc; // The underlying allocator.
return __a1.__underlying_alloc == __a2.__underlying_alloc;
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Tp, class _Alloc>
inline bool operator!=(const __allocator<_Tp, _Alloc>& __a1,
const __allocator<_Tp, _Alloc>& __a2)
{
return __a1.__underlying_alloc != __a2.__underlying_alloc;
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
// Comparison operators for all of the predifined SGI-style allocators.
// This ensures that __allocator<malloc_alloc> (for example) will
return true;
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <int __inst>
inline bool operator!=(const __malloc_alloc_template<__inst>&,
const __malloc_alloc_template<__inst>&)
{
return false;
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
template <class _Alloc>
inline bool operator==(const debug_alloc<_Alloc>&,
return true;
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class _Alloc>
inline bool operator!=(const debug_alloc<_Alloc>&,
const debug_alloc<_Alloc>&) {
return false;
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
// Another allocator adaptor: _Alloc_traits. This serves two
// purposes. First, make it possible to write containers that can use
struct _Alloc_traits
{
static const bool _S_instanceless = false;
- typedef typename _Allocator::__STL_TEMPLATE rebind<_Tp>::other
- allocator_type;
+ typedef typename _Allocator::template rebind<_Tp>::other allocator_type;
};
template <class _Tp, class _Allocator>
typedef __allocator<_Tp, debug_alloc<_Alloc> > allocator_type;
};
-
-#endif /* __STL_USE_STD_ALLOCATORS */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#endif
-
-__STL_END_NAMESPACE
-
-#undef __PRIVATE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_ALLOC_H */
#include <new>
-__STL_BEGIN_NAMESPACE
+namespace std
+{
// construct and destroy. These functions are not part of the C++ standard,
// and are provided for backward compatibility with the HP STL. We also
inline void _Destroy(long*, long*) {}
inline void _Destroy(float*, float*) {}
inline void _Destroy(double*, double*) {}
-#ifdef __STL_HAS_WCHAR_T
inline void _Destroy(wchar_t*, wchar_t*) {}
-#endif /* __STL_HAS_WCHAR_T */
// --------------------------------------------------
// Old names from the HP STL.
_Destroy(__first, __last);
}
-__STL_END_NAMESPACE
+} // namespace std
#endif /* _CPP_BITS_STL_CONSTRUCT_H */
* template template parameters), and it has been removed.
*/
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
+namespace std
+{
// Note: this function is simply a kludge to work around several compilers'
// bugs in handling constant expressions.
_M_last(__x._M_last), _M_node(__x._M_node) {}
reference operator*() const { return *_M_cur; }
-#ifndef __SGI_STL_NO_ARROW_OPERATOR
pointer operator->() const { return _M_cur; }
-#endif /* __SGI_STL_NO_ARROW_OPERATOR */
difference_type operator-(const _Self& __x) const {
return difference_type(_S_buffer_size()) * (_M_node - __x._M_node - 1) +
return __x + __n;
}
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _Tp, class _Ref, class _Ptr>
-inline random_access_iterator_tag
-iterator_category(const _Deque_iterator<_Tp,_Ref,_Ptr>&)
-{
- return random_access_iterator_tag();
-}
-
-template <class _Tp, class _Ref, class _Ptr>
-inline _Tp* value_type(const _Deque_iterator<_Tp,_Ref,_Ptr>&) { return 0; }
-
-template <class _Tp, class _Ref, class _Ptr>
-inline ptrdiff_t* distance_type(const _Deque_iterator<_Tp,_Ref,_Ptr>&) {
- return 0;
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
// Deque base class. It has two purposes. First, its constructor
// and destructor allocate (but don't initialize) storage. This makes
// the differences between SGI-style allocators and standard-conforming
// allocators.
-#ifdef __STL_USE_STD_ALLOCATORS
-
// Base class for ordinary allocators.
template <class _Tp, class _Alloc, bool __is_static>
class _Deque_alloc_base {
iterator _M_finish;
};
-#else /* __STL_USE_STD_ALLOCATORS */
-
-template <class _Tp, class _Alloc>
-class _Deque_base {
-public:
- typedef _Deque_iterator<_Tp,_Tp&,_Tp*> iterator;
- typedef _Deque_iterator<_Tp,const _Tp&,const _Tp*> const_iterator;
-
- typedef _Alloc allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-
- _Deque_base(const allocator_type&, size_t __num_elements)
- : _M_map(0), _M_map_size(0), _M_start(), _M_finish() {
- _M_initialize_map(__num_elements);
- }
- _Deque_base(const allocator_type&)
- : _M_map(0), _M_map_size(0), _M_start(), _M_finish() {}
- ~_Deque_base();
-
-protected:
- void _M_initialize_map(size_t);
- void _M_create_nodes(_Tp** __nstart, _Tp** __nfinish);
- void _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish);
- enum { _S_initial_map_size = 8 };
-
-protected:
- _Tp** _M_map;
- size_t _M_map_size;
- iterator _M_start;
- iterator _M_finish;
-
- typedef simple_alloc<_Tp, _Alloc> _Node_alloc_type;
- typedef simple_alloc<_Tp*, _Alloc> _Map_alloc_type;
-
- _Tp* _M_allocate_node()
- { return _Node_alloc_type::allocate(__deque_buf_size(sizeof(_Tp))); }
- void _M_deallocate_node(_Tp* __p)
- { _Node_alloc_type::deallocate(__p, __deque_buf_size(sizeof(_Tp))); }
- _Tp** _M_allocate_map(size_t __n)
- { return _Map_alloc_type::allocate(__n); }
- void _M_deallocate_map(_Tp** __p, size_t __n)
- { _Map_alloc_type::deallocate(__p, __n); }
-};
-
-#endif /* __STL_USE_STD_ALLOCATORS */
-
// Non-inline member functions from _Deque_base.
template <class _Tp, class _Alloc>
_M_deallocate_node(*__n);
}
-template <class _Tp, class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
+template <class _Tp, class _Alloc = allocator<_Tp> >
class deque : protected _Deque_base<_Tp, _Alloc> {
// requirements:
typedef typename _Base::iterator iterator;
typedef typename _Base::const_iterator const_iterator;
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
typedef reverse_iterator<const_iterator> const_reverse_iterator;
typedef reverse_iterator<iterator> reverse_iterator;
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
- typedef reverse_iterator<const_iterator, value_type, const_reference,
- difference_type>
- const_reverse_iterator;
- typedef reverse_iterator<iterator, value_type, reference, difference_type>
- reverse_iterator;
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
protected: // Internal typedefs
typedef pointer* _Map_pointer;
static size_t _S_buffer_size() { return __deque_buf_size(sizeof(_Tp)); }
protected:
-#ifdef __STL_USE_NAMESPACES
using _Base::_M_initialize_map;
using _Base::_M_create_nodes;
using _Base::_M_destroy_nodes;
using _Base::_M_map_size;
using _Base::_M_start;
using _Base::_M_finish;
-#endif /* __STL_USE_NAMESPACES */
public: // Basic accessors
iterator begin() { return _M_start; }
const_reference operator[](size_type __n) const
{ return _M_start[difference_type(__n)]; }
-#ifdef __STL_THROW_RANGE_ERRORS
void _M_range_check(size_type __n) const {
if (__n >= this->size())
__throw_range_error("deque");
{ _M_range_check(__n); return (*this)[__n]; }
const_reference at(size_type __n) const
{ _M_range_check(__n); return (*this)[__n]; }
-#endif /* __STL_THROW_RANGE_ERRORS */
reference front() { return *_M_start; }
reference back() {
explicit deque(size_type __n) : _Base(allocator_type(), __n)
{ _M_fill_initialize(value_type()); }
-#ifdef __STL_MEMBER_TEMPLATES
-
// Check whether it's an integral type. If so, it's not an iterator.
template <class _InputIterator>
deque(_InputIterator __first, _InputIterator __last,
_M_range_initialize(__first, __last, __ITERATOR_CATEGORY(__first));
}
-#else /* __STL_MEMBER_TEMPLATES */
-
- deque(const value_type* __first, const value_type* __last,
- const allocator_type& __a = allocator_type())
- : _Base(__a, __last - __first)
- { uninitialized_copy(__first, __last, _M_start); }
- deque(const_iterator __first, const_iterator __last,
- const allocator_type& __a = allocator_type())
- : _Base(__a, __last - __first)
- { uninitialized_copy(__first, __last, _M_start); }
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
~deque() { destroy(_M_start, _M_finish); }
deque& operator= (const deque& __x) {
}
void swap(deque& __x) {
- __STD::swap(_M_start, __x._M_start);
- __STD::swap(_M_finish, __x._M_finish);
- __STD::swap(_M_map, __x._M_map);
- __STD::swap(_M_map_size, __x._M_map_size);
+ std::swap(_M_start, __x._M_start);
+ std::swap(_M_finish, __x._M_finish);
+ std::swap(_M_map, __x._M_map);
+ std::swap(_M_map_size, __x._M_map_size);
}
public:
_M_fill_assign(__n, __val);
}
-#ifdef __STL_MEMBER_TEMPLATES
-
template <class _InputIterator>
void assign(_InputIterator __first, _InputIterator __last) {
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
erase(copy(__first, __last, begin()), end());
}
-#endif /* __STL_MEMBER_TEMPLATES */
-
public: // push_* and pop_*
void push_back(const value_type& __t) {
void _M_fill_insert(iterator __pos, size_type __n, const value_type& __x);
-#ifdef __STL_MEMBER_TEMPLATES
-
// Check whether it's an integral type. If so, it's not an iterator.
template <class _InputIterator>
void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
insert(__pos, __first, __last, __ITERATOR_CATEGORY(__first));
}
-#else /* __STL_MEMBER_TEMPLATES */
-
- void insert(iterator __pos,
- const value_type* __first, const value_type* __last);
- void insert(iterator __pos,
- const_iterator __first, const_iterator __last);
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
void resize(size_type __new_size, const value_type& __x) {
const size_type __len = size();
if (__new_size < __len)
void _M_fill_initialize(const value_type& __value);
-#ifdef __STL_MEMBER_TEMPLATES
-
template <class _InputIterator>
void _M_range_initialize(_InputIterator __first, _InputIterator __last,
input_iterator_tag);
void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
forward_iterator_tag);
-#endif /* __STL_MEMBER_TEMPLATES */
-
protected: // Internal push_* and pop_*
void _M_push_back_aux(const value_type&);
protected: // Internal insert functions
-#ifdef __STL_MEMBER_TEMPLATES
-
template <class _InputIterator>
void insert(iterator __pos, _InputIterator __first, _InputIterator __last,
input_iterator_tag);
_ForwardIterator __first, _ForwardIterator __last,
forward_iterator_tag);
-#endif /* __STL_MEMBER_TEMPLATES */
-
iterator _M_insert_aux(iterator __pos, const value_type& __x);
iterator _M_insert_aux(iterator __pos);
void _M_insert_aux(iterator __pos, size_type __n, const value_type& __x);
-#ifdef __STL_MEMBER_TEMPLATES
-
template <class _ForwardIterator>
void _M_insert_aux(iterator __pos,
_ForwardIterator __first, _ForwardIterator __last,
size_type __n);
-#else /* __STL_MEMBER_TEMPLATES */
-
- void _M_insert_aux(iterator __pos,
- const value_type* __first, const value_type* __last,
- size_type __n);
-
- void _M_insert_aux(iterator __pos,
- const_iterator __first, const_iterator __last,
- size_type __n);
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
iterator _M_reserve_elements_at_front(size_type __n) {
size_type __vacancies = _M_start._M_cur - _M_start._M_first;
if (__n > __vacancies)
// Non-inline member functions
-#ifdef __STL_MEMBER_TEMPLATES
-
template <class _Tp, class _Alloc>
template <class _InputIter>
void deque<_Tp, _Alloc>
insert(end(), __first, __last);
}
-#endif /* __STL_MEMBER_TEMPLATES */
-
template <class _Tp, class _Alloc>
void deque<_Tp, _Alloc>::_M_fill_insert(iterator __pos,
size_type __n, const value_type& __x)
_M_insert_aux(__pos, __n, __x);
}
-#ifndef __STL_MEMBER_TEMPLATES
-
-template <class _Tp, class _Alloc>
-void deque<_Tp, _Alloc>::insert(iterator __pos,
- const value_type* __first,
- const value_type* __last) {
- size_type __n = __last - __first;
- if (__pos._M_cur == _M_start._M_cur) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- __STL_TRY {
- uninitialized_copy(__first, __last, __new_start);
- _M_start = __new_start;
- }
- __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node));
- }
- else if (__pos._M_cur == _M_finish._M_cur) {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- __STL_TRY {
- uninitialized_copy(__first, __last, _M_finish);
- _M_finish = __new_finish;
- }
- __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1,
- __new_finish._M_node + 1));
- }
- else
- _M_insert_aux(__pos, __first, __last, __n);
-}
-
-template <class _Tp, class _Alloc>
-void deque<_Tp,_Alloc>::insert(iterator __pos,
- const_iterator __first, const_iterator __last)
-{
- size_type __n = __last - __first;
- if (__pos._M_cur == _M_start._M_cur) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- __STL_TRY {
- uninitialized_copy(__first, __last, __new_start);
- _M_start = __new_start;
- }
- __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node));
- }
- else if (__pos._M_cur == _M_finish._M_cur) {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- __STL_TRY {
- uninitialized_copy(__first, __last, _M_finish);
- _M_finish = __new_finish;
- }
- __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1,
- __new_finish._M_node + 1));
- }
- else
- _M_insert_aux(__pos, __first, __last, __n);
-}
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
template <class _Tp, class _Alloc>
typename deque<_Tp,_Alloc>::iterator
deque<_Tp,_Alloc>::erase(iterator __first, iterator __last)
__STL_UNWIND(destroy(_M_start, iterator(*__cur, __cur)));
}
-#ifdef __STL_MEMBER_TEMPLATES
-
template <class _Tp, class _Alloc> template <class _InputIterator>
void deque<_Tp,_Alloc>::_M_range_initialize(_InputIterator __first,
_InputIterator __last,
__STL_UNWIND(destroy(_M_start, iterator(*__cur_node, __cur_node)));
}
-#endif /* __STL_MEMBER_TEMPLATES */
-
// Called only if _M_finish._M_cur == _M_finish._M_last - 1.
template <class _Tp, class _Alloc>
void deque<_Tp,_Alloc>::_M_push_back_aux(const value_type& __t)
_M_start._M_cur = _M_start._M_first;
}
-#ifdef __STL_MEMBER_TEMPLATES
-
template <class _Tp, class _Alloc> template <class _InputIterator>
void deque<_Tp,_Alloc>::insert(iterator __pos,
_InputIterator __first, _InputIterator __last,
_M_insert_aux(__pos, __first, __last, __n);
}
-#endif /* __STL_MEMBER_TEMPLATES */
-
template <class _Tp, class _Alloc>
typename deque<_Tp, _Alloc>::iterator
deque<_Tp,_Alloc>::_M_insert_aux(iterator __pos, const value_type& __x)
}
}
-#ifdef __STL_MEMBER_TEMPLATES
-
template <class _Tp, class _Alloc> template <class _ForwardIterator>
void deque<_Tp,_Alloc>::_M_insert_aux(iterator __pos,
_ForwardIterator __first,
}
}
-#else /* __STL_MEMBER_TEMPLATES */
-
-template <class _Tp, class _Alloc>
-void deque<_Tp,_Alloc>::_M_insert_aux(iterator __pos,
- const value_type* __first,
- const value_type* __last,
- size_type __n)
-{
- const difference_type __elemsbefore = __pos - _M_start;
- size_type __length = size();
- if (__elemsbefore < __length / 2) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- iterator __old_start = _M_start;
- __pos = _M_start + __elemsbefore;
- __STL_TRY {
- if (__elemsbefore >= difference_type(__n)) {
- iterator __start_n = _M_start + difference_type(__n);
- uninitialized_copy(_M_start, __start_n, __new_start);
- _M_start = __new_start;
- copy(__start_n, __pos, __old_start);
- copy(__first, __last, __pos - difference_type(__n));
- }
- else {
- const value_type* __mid =
- __first + (difference_type(__n) - __elemsbefore);
- __uninitialized_copy_copy(_M_start, __pos, __first, __mid,
- __new_start);
- _M_start = __new_start;
- copy(__mid, __last, __old_start);
- }
- }
- __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node));
- }
- else {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- iterator __old_finish = _M_finish;
- const difference_type __elemsafter =
- difference_type(__length) - __elemsbefore;
- __pos = _M_finish - __elemsafter;
- __STL_TRY {
- if (__elemsafter > difference_type(__n)) {
- iterator __finish_n = _M_finish - difference_type(__n);
- uninitialized_copy(__finish_n, _M_finish, _M_finish);
- _M_finish = __new_finish;
- copy_backward(__pos, __finish_n, __old_finish);
- copy(__first, __last, __pos);
- }
- else {
- const value_type* __mid = __first + __elemsafter;
- __uninitialized_copy_copy(__mid, __last, __pos, _M_finish, _M_finish);
- _M_finish = __new_finish;
- copy(__first, __mid, __pos);
- }
- }
- __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1,
- __new_finish._M_node + 1));
- }
-}
-
-template <class _Tp, class _Alloc>
-void deque<_Tp,_Alloc>::_M_insert_aux(iterator __pos,
- const_iterator __first,
- const_iterator __last,
- size_type __n)
-{
- const difference_type __elemsbefore = __pos - _M_start;
- size_type __length = size();
- if (__elemsbefore < __length / 2) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- iterator __old_start = _M_start;
- __pos = _M_start + __elemsbefore;
- __STL_TRY {
- if (__elemsbefore >= __n) {
- iterator __start_n = _M_start + __n;
- uninitialized_copy(_M_start, __start_n, __new_start);
- _M_start = __new_start;
- copy(__start_n, __pos, __old_start);
- copy(__first, __last, __pos - difference_type(__n));
- }
- else {
- const_iterator __mid = __first + (__n - __elemsbefore);
- __uninitialized_copy_copy(_M_start, __pos, __first, __mid,
- __new_start);
- _M_start = __new_start;
- copy(__mid, __last, __old_start);
- }
- }
- __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node));
- }
- else {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- iterator __old_finish = _M_finish;
- const difference_type __elemsafter = __length - __elemsbefore;
- __pos = _M_finish - __elemsafter;
- __STL_TRY {
- if (__elemsafter > __n) {
- iterator __finish_n = _M_finish - difference_type(__n);
- uninitialized_copy(__finish_n, _M_finish, _M_finish);
- _M_finish = __new_finish;
- copy_backward(__pos, __finish_n, __old_finish);
- copy(__first, __last, __pos);
- }
- else {
- const_iterator __mid = __first + __elemsafter;
- __uninitialized_copy_copy(__mid, __last, __pos, _M_finish, _M_finish);
- _M_finish = __new_finish;
- copy(__first, __mid, __pos);
- }
- }
- __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1,
- __new_finish._M_node + 1));
- }
-}
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
template <class _Tp, class _Alloc>
void deque<_Tp,_Alloc>::_M_new_elements_at_front(size_type __new_elems)
{
__y.begin(), __y.end());
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _Tp, class _Alloc>
inline bool operator!=(const deque<_Tp, _Alloc>& __x,
const deque<_Tp, _Alloc>& __y) {
__x.swap(__y);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_DEQUE_H */
#ifndef __SGI_STL_INTERNAL_FUNCTION_H
#define __SGI_STL_INTERNAL_FUNCTION_H
-__STL_BEGIN_NAMESPACE
+namespace std
+{
template <class _Arg, class _Result>
struct unary_function {
_Ret (_Tp::*_M_f)(_Arg) const;
};
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
template <class _Tp>
class mem_fun_t<void, _Tp> : public unary_function<_Tp*,void> {
public:
void (_Tp::*_M_f)(_Arg) const;
};
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
// Mem_fun adaptor helper functions. There are only two:
// mem_fun and mem_fun_ref. (mem_fun1 and mem_fun1_ref
mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const)
{ return const_mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_FUNCTION_H */
#ifndef _CPP_BITS_STL_HEAP_H
#define _CPP_BITS_STL_HEAP_H 1
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1209
-#endif
+namespace std
+{
// Heap-manipulation functions: push_heap, pop_heap, make_heap, sort_heap.
pop_heap(__first, __last--, __comp);
}
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1209
-#endif
-
-__STL_END_NAMESPACE
+} // namespace std
#endif /* _CPP_BITS_STL_HEAP_H */
#ifndef __SGI_STL_INTERNAL_ITERATOR_H
#define __SGI_STL_INTERNAL_ITERATOR_H
-__STL_BEGIN_NAMESPACE
-
+namespace std
+{
template <class _Container>
class back_insert_iterator {
back_insert_iterator<_Container>& operator++(int) { return *this; }
};
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _Container>
-inline output_iterator_tag
-iterator_category(const back_insert_iterator<_Container>&)
-{
- return output_iterator_tag();
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
template <class _Container>
inline back_insert_iterator<_Container> back_inserter(_Container& __x) {
return back_insert_iterator<_Container>(__x);
front_insert_iterator<_Container>& operator++(int) { return *this; }
};
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _Container>
-inline output_iterator_tag
-iterator_category(const front_insert_iterator<_Container>&)
-{
- return output_iterator_tag();
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
template <class _Container>
inline front_insert_iterator<_Container> front_inserter(_Container& __x) {
return front_insert_iterator<_Container>(__x);
insert_iterator<_Container>& operator++(int) { return *this; }
};
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _Container>
-inline output_iterator_tag
-iterator_category(const insert_iterator<_Container>&)
-{
- return output_iterator_tag();
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
template <class _Container, class _Iterator>
inline
insert_iterator<_Container> inserter(_Container& __x, _Iterator __i)
_BidirectionalIterator __tmp = current;
return *--__tmp;
}
-#ifndef __SGI_STL_NO_ARROW_OPERATOR
pointer operator->() const { return &(operator*()); }
-#endif /* __SGI_STL_NO_ARROW_OPERATOR */
_Self& operator++() {
--current;
return *this;
}
};
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _BidirectionalIterator, class _Tp, class _Reference,
- class _Distance>
-inline bidirectional_iterator_tag
-iterator_category(const reverse_bidirectional_iterator<_BidirectionalIterator,
- _Tp, _Reference,
- _Distance>&)
-{
- return bidirectional_iterator_tag();
-}
-
-template <class _BidirectionalIterator, class _Tp, class _Reference,
- class _Distance>
-inline _Tp*
-value_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
- _Reference, _Distance>&)
-{
- return (_Tp*) 0;
-}
-
-template <class _BidirectionalIterator, class _Tp, class _Reference,
- class _Distance>
-inline _Distance*
-distance_type(const reverse_bidirectional_iterator<_BidirectionalIterator,
- _Tp,
- _Reference, _Distance>&)
-{
- return (_Distance*) 0;
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
template <class _BiIter, class _Tp, class _Ref, class _Distance>
inline bool operator==(
const reverse_bidirectional_iterator<_BiIter, _Tp, _Ref, _Distance>& __x,
return __x.base() == __y.base();
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _BiIter, class _Tp, class _Ref, class _Distance>
inline bool operator!=(
const reverse_bidirectional_iterator<_BiIter, _Tp, _Ref, _Distance>& __x,
return !(__x == __y);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
// This is the new version of reverse_iterator, as defined in the
// draft C++ standard. It relies on the iterator_traits template,
explicit reverse_iterator(iterator_type __x) : current(__x) {}
reverse_iterator(const _Self& __x) : current(__x.current) {}
-#ifdef __STL_MEMBER_TEMPLATES
template <class _Iter>
reverse_iterator(const reverse_iterator<_Iter>& __x)
: current(__x.base()) {}
-#endif /* __STL_MEMBER_TEMPLATES */
iterator_type base() const { return current; }
reference operator*() const {
_Iterator __tmp = current;
return *--__tmp;
}
-#ifndef __SGI_STL_NO_ARROW_OPERATOR
pointer operator->() const { return &(operator*()); }
-#endif /* __SGI_STL_NO_ARROW_OPERATOR */
_Self& operator++() {
--current;
return __y.base() < __x.base();
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _Iterator>
inline bool operator!=(const reverse_iterator<_Iterator>& __x,
const reverse_iterator<_Iterator>& __y) {
return !(__x < __y);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
template <class _Iterator>
inline typename reverse_iterator<_Iterator>::difference_type
operator-(const reverse_iterator<_Iterator>& __x,
return reverse_iterator<_Iterator>(__x.base() - __n);
}
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-// This is the old version of reverse_iterator, as found in the original
-// HP STL. It does not use partial specialization.
-
-template <class _RandomAccessIterator, class _Tp, class _Reference = _Tp&,
- class _Distance = ptrdiff_t>
-class reverse_iterator {
- typedef reverse_iterator<_RandomAccessIterator, _Tp, _Reference, _Distance>
- _Self;
-protected:
- _RandomAccessIterator current;
-public:
- typedef random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Tp* pointer;
- typedef _Reference reference;
-
- reverse_iterator() {}
- explicit reverse_iterator(_RandomAccessIterator __x) : current(__x) {}
- _RandomAccessIterator base() const { return current; }
- _Reference operator*() const { return *(current - 1); }
-#ifndef __SGI_STL_NO_ARROW_OPERATOR
- pointer operator->() const { return &(operator*()); }
-#endif /* __SGI_STL_NO_ARROW_OPERATOR */
- _Self& operator++() {
- --current;
- return *this;
- }
- _Self operator++(int) {
- _Self __tmp = *this;
- --current;
- return __tmp;
- }
- _Self& operator--() {
- ++current;
- return *this;
- }
- _Self operator--(int) {
- _Self __tmp = *this;
- ++current;
- return __tmp;
- }
- _Self operator+(_Distance __n) const {
- return _Self(current - __n);
- }
- _Self& operator+=(_Distance __n) {
- current -= __n;
- return *this;
- }
- _Self operator-(_Distance __n) const {
- return _Self(current + __n);
- }
- _Self& operator-=(_Distance __n) {
- current += __n;
- return *this;
- }
- _Reference operator[](_Distance __n) const { return *(*this + __n); }
-};
-
-template <class _RandomAccessIterator, class _Tp,
- class _Reference, class _Distance>
-inline random_access_iterator_tag
-iterator_category(const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>&)
-{
- return random_access_iterator_tag();
-}
-
-template <class _RandomAccessIterator, class _Tp,
- class _Reference, class _Distance>
-inline _Tp* value_type(const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>&)
-{
- return (_Tp*) 0;
-}
-
-template <class _RandomAccessIterator, class _Tp,
- class _Reference, class _Distance>
-inline _Distance*
-distance_type(const reverse_iterator<_RandomAccessIterator,
- _Tp, _Reference, _Distance>&)
-{
- return (_Distance*) 0;
-}
-
-
-template <class _RandomAccessIterator, class _Tp,
- class _Reference, class _Distance>
-inline bool
-operator==(const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>& __x,
- const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>& __y)
-{
- return __x.base() == __y.base();
-}
-
-template <class _RandomAccessIterator, class _Tp,
- class _Reference, class _Distance>
-inline bool
-operator<(const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>& __x,
- const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>& __y)
-{
- return __y.base() < __x.base();
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
-template <class _RandomAccessIterator, class _Tp,
- class _Reference, class _Distance>
-inline bool
-operator!=(const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>& __x,
- const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>& __y) {
- return !(__x == __y);
-}
-
-template <class _RandomAccessIterator, class _Tp,
- class _Reference, class _Distance>
-inline bool
-operator>(const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>& __x,
- const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>& __y) {
- return __y < __x;
-}
-
-template <class _RandomAccessIterator, class _Tp,
- class _Reference, class _Distance>
-inline bool
-operator<=(const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>& __x,
- const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>& __y) {
- return !(__y < __x);
-}
-
-template <class _RandomAccessIterator, class _Tp,
- class _Reference, class _Distance>
-inline bool
-operator>=(const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>& __x,
- const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>& __y) {
- return !(__x < __y);
-}
-
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-template <class _RandomAccessIterator, class _Tp,
- class _Reference, class _Distance>
-inline _Distance
-operator-(const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>& __x,
- const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>& __y)
-{
- return __y.base() - __x.base();
-}
-
-template <class _RandAccIter, class _Tp, class _Ref, class _Dist>
-inline reverse_iterator<_RandAccIter, _Tp, _Ref, _Dist>
-operator+(_Dist __n,
- const reverse_iterator<_RandAccIter, _Tp, _Ref, _Dist>& __x)
-{
- return reverse_iterator<_RandAccIter, _Tp, _Ref, _Dist>(__x.base() - __n);
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-// istream_iterator and ostream_iterator look very different if we're
-// using new, templatized iostreams than if we're using the old cfront
-// version.
-
-#ifdef __STL_USE_NEW_IOSTREAMS
template <class _Tp,
class _CharT = char, class _Traits = char_traits<_CharT>,
return __x._M_equal(__y);
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _Tp, class _CharT, class _Traits, class _Dist>
inline bool
operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x,
return !__x._M_equal(__y);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
template <class _Tp,
class _CharT = char, class _Traits = char_traits<_CharT> >
const _CharT* _M_string;
};
-// The default template argument is declared in iosfwd
-
-// We do not read any characters until operator* is called. The first
-// time operator* is called, it calls getc. Subsequent calls to getc
-// return a cached character, and calls to operator++ use snextc. Before
-// operator* or operator++ has been called, _M_is_initialized is false.
-template<class _CharT, class _Traits>
-class istreambuf_iterator
- : public iterator<input_iterator_tag, _CharT,
- typename _Traits::off_type, _CharT*, _CharT&>
-{
-public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename _Traits::int_type int_type;
- typedef basic_streambuf<_CharT, _Traits> streambuf_type;
- typedef basic_istream<_CharT, _Traits> istream_type;
-
-public:
- istreambuf_iterator(streambuf_type* __p = 0) { this->_M_init(__p); }
- istreambuf_iterator(istream_type& __is) { this->_M_init(__is.rdbuf()); }
-
- char_type operator*() const
- { return _M_is_initialized ? _M_c : _M_dereference_aux(); }
-
- istreambuf_iterator& operator++() { this->_M_nextc(); return *this; }
- istreambuf_iterator operator++(int) {
- if (!_M_is_initialized)
- _M_postincr_aux();
- istreambuf_iterator __tmp = *this;
- this->_M_nextc();
- return __tmp;
- }
-
- bool equal(const istreambuf_iterator& __i) const {
- return this->_M_is_initialized && __i._M_is_initialized
- ? this->_M_eof == __i._M_eof
- : this->_M_equal_aux(__i);
- }
-
-private:
- void _M_init(streambuf_type* __p) {
- _M_buf = __p;
- _M_eof = !__p;
- _M_is_initialized = _M_eof;
- }
-
- char_type _M_dereference_aux() const;
- bool _M_equal_aux(const istreambuf_iterator&) const;
- void _M_postincr_aux();
-
- void _M_nextc() {
- int_type __c = _M_buf->snextc();
- _M_c = traits_type::to_char_type(__c);
- _M_eof = traits_type::eq_int_type(__c, traits_type::eof());
- _M_is_initialized = true;
- }
-
- void _M_getc() const {
- int_type __c = _M_buf->sgetc();
- _M_c = traits_type::to_char_type(__c);
- _M_eof = traits_type::eq_int_type(__c, traits_type::eof());
- _M_is_initialized = true;
- }
-
-private:
- streambuf_type* _M_buf;
- mutable _CharT _M_c;
- mutable bool _M_eof : 1;
- mutable bool _M_is_initialized : 1;
-};
-
-template<class _CharT, class _Traits>
-_CharT istreambuf_iterator<_CharT, _Traits>::_M_dereference_aux() const
-{
- this->_M_getc();
- return _M_c;
-}
-
-template<class _CharT, class _Traits>
-bool istreambuf_iterator<_CharT, _Traits>
- ::_M_equal_aux(const istreambuf_iterator& __i) const
-{
- if (!this->_M_is_initialized)
- this->_M_getc();
- if (!__i._M_is_initialized)
- __i._M_getc();
-
- return this->_M_eof == __i._M_eof;
-}
-
-template<class _CharT, class _Traits>
-void istreambuf_iterator<_CharT, _Traits>::_M_postincr_aux()
-{
- this->_M_getc();
-}
-
-template<class _CharT, class _Traits>
-inline bool operator==(const istreambuf_iterator<_CharT, _Traits>& __x,
- const istreambuf_iterator<_CharT, _Traits>& __y) {
- return __x.equal(__y);
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
-template<class _CharT, class _Traits>
-inline bool operator!=(const istreambuf_iterator<_CharT, _Traits>& __x,
- const istreambuf_iterator<_CharT, _Traits>& __y) {
- return !__x.equal(__y);
-}
-
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-// The default template argument is declared in iosfwd
-template<class _CharT, class _Traits>
-class ostreambuf_iterator
- : public iterator<output_iterator_tag, void, void, void, void>
-{
-public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename _Traits::int_type int_type;
- typedef basic_streambuf<_CharT, _Traits> streambuf_type;
- typedef basic_ostream<_CharT, _Traits> ostream_type;
-
-public:
- ostreambuf_iterator(streambuf_type* __buf) : _M_buf(__buf), _M_ok(__buf) {}
- ostreambuf_iterator(ostream_type& __o)
- : _M_buf(__o.rdbuf()), _M_ok(__o.rdbuf() != 0) {}
-
- ostreambuf_iterator& operator=(char_type __c) {
- _M_ok = _M_ok && !traits_type::eq_int_type(_M_buf->sputc(__c),
- traits_type::eof());
- return *this;
- }
-
- ostreambuf_iterator& operator*() { return *this; }
- ostreambuf_iterator& operator++() { return *this; }
- ostreambuf_iterator& operator++(int) { return *this; }
-
- bool failed() const { return !_M_ok; }
-
-private:
- streambuf_type* _M_buf;
- bool _M_ok;
-};
-
-#else /* __STL_USE_NEW_IOSTREAMS */
-
-template <class _Tp, class _Dist = ptrdiff_t> class istream_iterator;
-
-template <class _Tp, class _Dist>
-inline bool operator==(const istream_iterator<_Tp, _Dist>&,
- const istream_iterator<_Tp, _Dist>&);
-
-template <class _Tp, class _Dist>
-class istream_iterator {
-#ifdef __STL_TEMPLATE_FRIENDS
- template <class _T1, class _D1>
- friend bool operator==(const istream_iterator<_T1, _D1>&,
- const istream_iterator<_T1, _D1>&);
-#else /* __STL_TEMPLATE_FRIENDS */
- friend bool __STD_QUALIFIER
- operator== __STL_NULL_TMPL_ARGS (const istream_iterator&,
- const istream_iterator&);
-#endif /* __STL_TEMPLATE_FRIENDS */
-
-protected:
- istream* _M_stream;
- _Tp _M_value;
- bool _M_end_marker;
- void _M_read() {
- _M_end_marker = (*_M_stream) ? true : false;
- if (_M_end_marker) *_M_stream >> _M_value;
- _M_end_marker = (*_M_stream) ? true : false;
- }
-public:
- typedef input_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Dist difference_type;
- typedef const _Tp* pointer;
- typedef const _Tp& reference;
-
- istream_iterator() : _M_stream(&cin), _M_end_marker(false) {}
- istream_iterator(istream& __s) : _M_stream(&__s) { _M_read(); }
- reference operator*() const { return _M_value; }
-#ifndef __SGI_STL_NO_ARROW_OPERATOR
- pointer operator->() const { return &(operator*()); }
-#endif /* __SGI_STL_NO_ARROW_OPERATOR */
- istream_iterator<_Tp, _Dist>& operator++() {
- _M_read();
- return *this;
- }
- istream_iterator<_Tp, _Dist> operator++(int) {
- istream_iterator<_Tp, _Dist> __tmp = *this;
- _M_read();
- return __tmp;
- }
-};
-
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _Tp, class _Dist>
-inline input_iterator_tag
-iterator_category(const istream_iterator<_Tp, _Dist>&)
-{
- return input_iterator_tag();
-}
-
-template <class _Tp, class _Dist>
-inline _Tp*
-value_type(const istream_iterator<_Tp, _Dist>&) { return (_Tp*) 0; }
-
-template <class _Tp, class _Dist>
-inline _Dist*
-distance_type(const istream_iterator<_Tp, _Dist>&) { return (_Dist*)0; }
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _Tp, class _Distance>
-inline bool operator==(const istream_iterator<_Tp, _Distance>& __x,
- const istream_iterator<_Tp, _Distance>& __y) {
- return (__x._M_stream == __y._M_stream &&
- __x._M_end_marker == __y._M_end_marker) ||
- __x._M_end_marker == false && __y._M_end_marker == false;
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
-template <class _Tp, class _Distance>
-inline bool operator!=(const istream_iterator<_Tp, _Distance>& __x,
- const istream_iterator<_Tp, _Distance>& __y) {
- return !(__x == __y);
-}
-
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-template <class _Tp>
-class ostream_iterator {
-protected:
- ostream* _M_stream;
- const char* _M_string;
-public:
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-
- ostream_iterator(ostream& __s) : _M_stream(&__s), _M_string(0) {}
- ostream_iterator(ostream& __s, const char* __c)
- : _M_stream(&__s), _M_string(__c) {}
- ostream_iterator<_Tp>& operator=(const _Tp& __value) {
- *_M_stream << __value;
- if (_M_string) *_M_stream << _M_string;
- return *this;
- }
- ostream_iterator<_Tp>& operator*() { return *this; }
- ostream_iterator<_Tp>& operator++() { return *this; }
- ostream_iterator<_Tp>& operator++(int) { return *this; }
-};
-
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _Tp>
-inline output_iterator_tag
-iterator_category(const ostream_iterator<_Tp>&) {
- return output_iterator_tag();
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-#endif /* __STL_USE_NEW_IOSTREAMS */
// This iterator adapter is 'normal' in the sense that it does not
// change the semantics of any of the operators of its itererator
const __normal_iterator<_Iterator, _Container>& __i)
{ return __normal_iterator<_Iterator, _Container>(__i.base() + __n); }
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_ITERATOR_H */
#include <bits/concept_checks.h>
-__STL_BEGIN_NAMESPACE
+namespace std
+{
struct input_iterator_tag {};
struct output_iterator_tag {};
typedef _Tp& reference;
};
-#ifdef __STL_USE_NAMESPACES
template <class _Category, class _Tp, class _Distance = ptrdiff_t,
class _Pointer = _Tp*, class _Reference = _Tp&>
struct iterator {
typedef _Pointer pointer;
typedef _Reference reference;
};
-#endif /* __STL_USE_NAMESPACES */
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
template <class _Iterator>
struct iterator_traits {
#define __DISTANCE_TYPE(__i) __distance_type(__i)
#define __VALUE_TYPE(__i) __value_type(__i)
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _Tp, class _Distance>
-inline input_iterator_tag
-iterator_category(const input_iterator<_Tp, _Distance>&)
- { return input_iterator_tag(); }
-
-inline output_iterator_tag iterator_category(const output_iterator&)
- { return output_iterator_tag(); }
-
-template <class _Tp, class _Distance>
-inline forward_iterator_tag
-iterator_category(const forward_iterator<_Tp, _Distance>&)
- { return forward_iterator_tag(); }
-
-template <class _Tp, class _Distance>
-inline bidirectional_iterator_tag
-iterator_category(const bidirectional_iterator<_Tp, _Distance>&)
- { return bidirectional_iterator_tag(); }
-
-template <class _Tp, class _Distance>
-inline random_access_iterator_tag
-iterator_category(const random_access_iterator<_Tp, _Distance>&)
- { return random_access_iterator_tag(); }
-
-template <class _Tp>
-inline random_access_iterator_tag iterator_category(const _Tp*)
- { return random_access_iterator_tag(); }
-
-template <class _Tp, class _Distance>
-inline _Tp* value_type(const input_iterator<_Tp, _Distance>&)
- { return (_Tp*)(0); }
-
-template <class _Tp, class _Distance>
-inline _Tp* value_type(const forward_iterator<_Tp, _Distance>&)
- { return (_Tp*)(0); }
-
-template <class _Tp, class _Distance>
-inline _Tp* value_type(const bidirectional_iterator<_Tp, _Distance>&)
- { return (_Tp*)(0); }
-
-template <class _Tp, class _Distance>
-inline _Tp* value_type(const random_access_iterator<_Tp, _Distance>&)
- { return (_Tp*)(0); }
-
-template <class _Tp>
-inline _Tp* value_type(const _Tp*) { return (_Tp*)(0); }
-
-template <class _Tp, class _Distance>
-inline _Distance* distance_type(const input_iterator<_Tp, _Distance>&)
-{
- return (_Distance*)(0);
-}
-
-template <class _Tp, class _Distance>
-inline _Distance* distance_type(const forward_iterator<_Tp, _Distance>&)
-{
- return (_Distance*)(0);
-}
-
-template <class _Tp, class _Distance>
-inline _Distance*
-distance_type(const bidirectional_iterator<_Tp, _Distance>&)
-{
- return (_Distance*)(0);
-}
-
-template <class _Tp, class _Distance>
-inline _Distance*
-distance_type(const random_access_iterator<_Tp, _Distance>&)
-{
- return (_Distance*)(0);
-}
-
-template <class _Tp>
-inline ptrdiff_t* distance_type(const _Tp*) { return (ptrdiff_t*)(0); }
-
-// Without partial specialization we can't use iterator_traits, so
-// we must keep the old iterator query functions around.
-
-#define __ITERATOR_CATEGORY(__i) iterator_category(__i)
-#define __DISTANCE_TYPE(__i) distance_type(__i)
-#define __VALUE_TYPE(__i) value_type(__i)
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
template <class _InputIterator, class _Distance>
inline void __distance(_InputIterator __first, _InputIterator __last,
_Distance& __n, input_iterator_tag)
__distance(__first, __last, __n, iterator_category(__first));
}
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
template <class _InputIterator>
inline typename iterator_traits<_InputIterator>::difference_type
__distance(_InputIterator __first, _InputIterator __last, input_iterator_tag)
return __distance(__first, __last, _Category());
}
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
template <class _InputIter, class _Distance>
inline void __advance(_InputIter& __i, _Distance __n, input_iterator_tag) {
while (__n--) ++__i;
}
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1183
-#endif
-
template <class _BidirectionalIterator, class _Distance>
inline void __advance(_BidirectionalIterator& __i, _Distance __n,
bidirectional_iterator_tag) {
while (__n++) --__i;
}
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1183
-#endif
-
template <class _RandomAccessIterator, class _Distance>
inline void __advance(_RandomAccessIterator& __i, _Distance __n,
random_access_iterator_tag) {
__advance(__i, __n, iterator_category(__i));
}
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_ITERATOR_BASE_H */
-
// Local Variables:
// mode:C++
// End:
#include <bits/concept_checks.h>
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
+namespace std
+{
struct _List_node_base {
_List_node_base* _M_next;
_List_iterator(const iterator& __x) : _List_iterator_base(__x._M_node) {}
reference operator*() const { return ((_Node*) _M_node)->_M_data; }
-
-#ifndef __SGI_STL_NO_ARROW_OPERATOR
pointer operator->() const { return &(operator*()); }
-#endif /* __SGI_STL_NO_ARROW_OPERATOR */
_Self& operator++() {
this->_M_incr();
}
};
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-inline bidirectional_iterator_tag
-iterator_category(const _List_iterator_base&)
-{
- return bidirectional_iterator_tag();
-}
-
-template <class _Tp, class _Ref, class _Ptr>
-inline _Tp*
-value_type(const _List_iterator<_Tp, _Ref, _Ptr>&)
-{
- return 0;
-}
-
-inline ptrdiff_t*
-distance_type(const _List_iterator_base&)
-{
- return 0;
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
// Base class that encapsulates details of allocators. Three cases:
// an ordinary standard-conforming allocator, a standard-conforming
// compatibility and because we want to avoid wasting storage on an
// allocator instance if it isn't necessary.
-#ifdef __STL_USE_STD_ALLOCATORS
// Base for general standard-conforming allocators.
template <class _Tp, class _Allocator, bool _IsStatic>
void clear();
};
-#else /* __STL_USE_STD_ALLOCATORS */
-
-template <class _Tp, class _Alloc>
-class _List_base
-{
-public:
- typedef _Alloc allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-
- _List_base(const allocator_type&) {
- _M_node = _M_get_node();
- _M_node->_M_next = _M_node;
- _M_node->_M_prev = _M_node;
- }
- ~_List_base() {
- clear();
- _M_put_node(_M_node);
- }
-
- void clear();
-
-protected:
- typedef simple_alloc<_List_node<_Tp>, _Alloc> _Alloc_type;
- _List_node<_Tp>* _M_get_node() { return _Alloc_type::allocate(1); }
- void _M_put_node(_List_node<_Tp>* __p) { _Alloc_type::deallocate(__p, 1); }
-
-protected:
- _List_node<_Tp>* _M_node;
-};
-
-#endif /* __STL_USE_STD_ALLOCATORS */
template <class _Tp, class _Alloc>
void
typedef _List_iterator<_Tp,_Tp&,_Tp*> iterator;
typedef _List_iterator<_Tp,const _Tp&,const _Tp*> const_iterator;
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
typedef reverse_iterator<const_iterator> const_reverse_iterator;
typedef reverse_iterator<iterator> reverse_iterator;
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
- typedef reverse_bidirectional_iterator<const_iterator,value_type,
- const_reference,difference_type>
- const_reverse_iterator;
- typedef reverse_bidirectional_iterator<iterator,value_type,reference,
- difference_type>
- reverse_iterator;
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
protected:
-#ifdef __STL_HAS_NAMESPACES
using _Base::_M_node;
using _Base::_M_put_node;
using _Base::_M_get_node;
-#endif /* __STL_HAS_NAMESPACES */
protected:
_Node* _M_create_node(const _Tp& __x)
reference back() { return *(--end()); }
const_reference back() const { return *(--end()); }
- void swap(list<_Tp, _Alloc>& __x) { __STD::swap(_M_node, __x._M_node); }
+ void swap(list<_Tp, _Alloc>& __x) { std::swap(_M_node, __x._M_node); }
iterator insert(iterator __position, const _Tp& __x) {
_Node* __tmp = _M_create_node(__x);
return __tmp;
}
iterator insert(iterator __position) { return insert(__position, _Tp()); }
-#ifdef __STL_MEMBER_TEMPLATES
- // Check whether it's an integral type. If so, it's not an iterator.
+ // Check whether it's an integral type. If so, it's not an iterator.
template<class _Integer>
void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
__true_type) {
_M_insert_dispatch(__pos, __first, __last, _Integral());
}
-#else /* __STL_MEMBER_TEMPLATES */
- void insert(iterator __position, const _Tp* __first, const _Tp* __last);
- void insert(iterator __position,
- const_iterator __first, const_iterator __last);
-#endif /* __STL_MEMBER_TEMPLATES */
void insert(iterator __pos, size_type __n, const _Tp& __x)
{ _M_fill_insert(__pos, __n, __x); }
void _M_fill_insert(iterator __pos, size_type __n, const _Tp& __x);
: _Base(allocator_type())
{ insert(begin(), __n, _Tp()); }
-#ifdef __STL_MEMBER_TEMPLATES
-
// We don't need any dispatching tricks here, because insert does all of
// that anyway.
template <class _InputIterator>
: _Base(__a)
{ insert(begin(), __first, __last); }
-#else /* __STL_MEMBER_TEMPLATES */
-
- list(const _Tp* __first, const _Tp* __last,
- const allocator_type& __a = allocator_type())
- : _Base(__a)
- { this->insert(begin(), __first, __last); }
- list(const_iterator __first, const_iterator __last,
- const allocator_type& __a = allocator_type())
- : _Base(__a)
- { this->insert(begin(), __first, __last); }
-
-#endif /* __STL_MEMBER_TEMPLATES */
list(const list<_Tp, _Alloc>& __x) : _Base(__x.get_allocator())
{ insert(begin(), __x.begin(), __x.end()); }
void _M_fill_assign(size_type __n, const _Tp& __val);
-#ifdef __STL_MEMBER_TEMPLATES
-
template <class _InputIterator>
void assign(_InputIterator __first, _InputIterator __last) {
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
__false_type);
-#endif /* __STL_MEMBER_TEMPLATES */
-
protected:
void transfer(iterator __position, iterator __first, iterator __last) {
if (__position != __last) {
void reverse();
void sort();
-#ifdef __STL_MEMBER_TEMPLATES
template <class _Predicate> void remove_if(_Predicate);
template <class _BinaryPredicate> void unique(_BinaryPredicate);
template <class _StrictWeakOrdering> void merge(list&, _StrictWeakOrdering);
template <class _StrictWeakOrdering> void sort(_StrictWeakOrdering);
-#endif /* __STL_MEMBER_TEMPLATES */
};
template <class _Tp, class _Alloc>
__y.begin(), __y.end());
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _Tp, class _Alloc>
inline bool operator!=(const list<_Tp,_Alloc>& __x,
const list<_Tp,_Alloc>& __y) {
__x.swap(__y);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-#ifdef __STL_MEMBER_TEMPLATES
-
template <class _Tp, class _Alloc> template <class _InputIter>
void
list<_Tp, _Alloc>::_M_insert_dispatch(iterator __position,
insert(__position, *__first);
}
-#else /* __STL_MEMBER_TEMPLATES */
-
-template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::insert(iterator __position,
- const _Tp* __first, const _Tp* __last)
-{
- for ( ; __first != __last; ++__first)
- insert(__position, *__first);
-}
-
-template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::insert(iterator __position,
- const_iterator __first, const_iterator __last)
-{
- for ( ; __first != __last; ++__first)
- insert(__position, *__first);
-}
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
template <class _Tp, class _Alloc>
void
list<_Tp, _Alloc>::_M_fill_insert(iterator __position,
erase(__i, end());
}
-#ifdef __STL_MEMBER_TEMPLATES
-
template <class _Tp, class _Alloc> template <class _InputIter>
void
list<_Tp, _Alloc>::_M_assign_dispatch(_InputIter __first2, _InputIter __last2,
insert(__last1, __first2, __last2);
}
-#endif /* __STL_MEMBER_TEMPLATES */
-
template <class _Tp, class _Alloc>
void list<_Tp, _Alloc>::remove(const _Tp& __value)
{
{
_List_node_base* __tmp = __p;
do {
- __STD::swap(__tmp->_M_next, __tmp->_M_prev);
+ std::swap(__tmp->_M_next, __tmp->_M_prev);
__tmp = __tmp->_M_prev; // Old next node is now prev.
} while (__tmp != __p);
}
}
}
-#ifdef __STL_MEMBER_TEMPLATES
-
template <class _Tp, class _Alloc> template <class _Predicate>
void list<_Tp, _Alloc>::remove_if(_Predicate __pred)
{
}
}
-#endif /* __STL_MEMBER_TEMPLATES */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_LIST_H */
#include <bits/concept_checks.h>
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
+namespace std
+{
template <class _Key, class _Tp, class _Compare = less<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
const allocator_type& __a = allocator_type())
: _M_t(__comp, __a) {}
-#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
map(_InputIterator __first, _InputIterator __last)
: _M_t(_Compare(), allocator_type())
map(_InputIterator __first, _InputIterator __last, const _Compare& __comp,
const allocator_type& __a = allocator_type())
: _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
-#else
- map(const value_type* __first, const value_type* __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_unique(__first, __last); }
-
- map(const value_type* __first,
- const value_type* __last, const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
-
- map(const_iterator __first, const_iterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_unique(__first, __last); }
-
- map(const_iterator __first, const_iterator __last, const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
map(const map<_Key,_Tp,_Compare,_Alloc>& __x) : _M_t(__x._M_t) {}
+
map<_Key,_Tp,_Compare,_Alloc>&
operator=(const map<_Key, _Tp, _Compare, _Alloc>& __x)
{
{ return _M_t.insert_unique(__x); }
iterator insert(iterator position, const value_type& __x)
{ return _M_t.insert_unique(position, __x); }
-#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last) {
_M_t.insert_unique(__first, __last);
}
-#else
- void insert(const value_type* __first, const value_type* __last) {
- _M_t.insert_unique(__first, __last);
- }
- void insert(const_iterator __first, const_iterator __last) {
- _M_t.insert_unique(__first, __last);
- }
-#endif /* __STL_MEMBER_TEMPLATES */
void erase(iterator __position) { _M_t.erase(__position); }
size_type erase(const key_type& __x) { return _M_t.erase(__x); }
return _M_t.equal_range(__x);
}
-#ifdef __STL_TEMPLATE_FRIENDS
template <class _K1, class _T1, class _C1, class _A1>
friend bool operator== (const map<_K1, _T1, _C1, _A1>&,
const map<_K1, _T1, _C1, _A1>&);
template <class _K1, class _T1, class _C1, class _A1>
friend bool operator< (const map<_K1, _T1, _C1, _A1>&,
const map<_K1, _T1, _C1, _A1>&);
-#else /* __STL_TEMPLATE_FRIENDS */
- friend bool __STD_QUALIFIER
- operator== __STL_NULL_TMPL_ARGS (const map&, const map&);
- friend bool __STD_QUALIFIER
- operator< __STL_NULL_TMPL_ARGS (const map&, const map&);
-#endif /* __STL_TEMPLATE_FRIENDS */
};
template <class _Key, class _Tp, class _Compare, class _Alloc>
return __x._M_t < __y._M_t;
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _Key, class _Tp, class _Compare, class _Alloc>
inline bool operator!=(const map<_Key,_Tp,_Compare,_Alloc>& __x,
const map<_Key,_Tp,_Compare,_Alloc>& __y) {
__x.swap(__y);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
+} // namespace std
#endif /* _CPP_BITS_STL_MAP_H */
#include <bits/concept_checks.h>
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
+namespace std
+{
// Forward declaration of operators < and ==, needed for friend declaration.
const allocator_type& __a = allocator_type())
: _M_t(__comp, __a) { }
-#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
multimap(_InputIterator __first, _InputIterator __last)
: _M_t(_Compare(), allocator_type())
const _Compare& __comp,
const allocator_type& __a = allocator_type())
: _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
-#else
- multimap(const value_type* __first, const value_type* __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_equal(__first, __last); }
- multimap(const value_type* __first, const value_type* __last,
- const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
-
- multimap(const_iterator __first, const_iterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_equal(__first, __last); }
- multimap(const_iterator __first, const_iterator __last,
- const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
-#endif /* __STL_MEMBER_TEMPLATES */
-
multimap(const multimap<_Key,_Tp,_Compare,_Alloc>& __x) : _M_t(__x._M_t) { }
+
multimap<_Key,_Tp,_Compare,_Alloc>&
operator=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x) {
_M_t = __x._M_t;
iterator insert(iterator __position, const value_type& __x) {
return _M_t.insert_equal(__position, __x);
}
-#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last) {
_M_t.insert_equal(__first, __last);
}
-#else
- void insert(const value_type* __first, const value_type* __last) {
- _M_t.insert_equal(__first, __last);
- }
- void insert(const_iterator __first, const_iterator __last) {
- _M_t.insert_equal(__first, __last);
- }
-#endif /* __STL_MEMBER_TEMPLATES */
void erase(iterator __position) { _M_t.erase(__position); }
size_type erase(const key_type& __x) { return _M_t.erase(__x); }
void erase(iterator __first, iterator __last)
return _M_t.equal_range(__x);
}
-#ifdef __STL_TEMPLATE_FRIENDS
template <class _K1, class _T1, class _C1, class _A1>
friend bool operator== (const multimap<_K1, _T1, _C1, _A1>&,
const multimap<_K1, _T1, _C1, _A1>&);
template <class _K1, class _T1, class _C1, class _A1>
friend bool operator< (const multimap<_K1, _T1, _C1, _A1>&,
const multimap<_K1, _T1, _C1, _A1>&);
-#else /* __STL_TEMPLATE_FRIENDS */
- friend bool __STD_QUALIFIER
- operator== __STL_NULL_TMPL_ARGS (const multimap&, const multimap&);
- friend bool __STD_QUALIFIER
- operator< __STL_NULL_TMPL_ARGS (const multimap&, const multimap&);
-#endif /* __STL_TEMPLATE_FRIENDS */
};
template <class _Key, class _Tp, class _Compare, class _Alloc>
return __x._M_t < __y._M_t;
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _Key, class _Tp, class _Compare, class _Alloc>
inline bool operator!=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
const multimap<_Key,_Tp,_Compare,_Alloc>& __y) {
__x.swap(__y);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_MULTIMAP_H */
#include <bits/concept_checks.h>
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
+namespace std
+{
// Forward declaration of operators < and ==, needed for friend declaration.
const allocator_type& __a = allocator_type())
: _M_t(__comp, __a) {}
-#ifdef __STL_MEMBER_TEMPLATES
-
template <class _InputIterator>
multiset(_InputIterator __first, _InputIterator __last)
: _M_t(_Compare(), allocator_type())
const allocator_type& __a = allocator_type())
: _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
-#else
-
- multiset(const value_type* __first, const value_type* __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_equal(__first, __last); }
-
- multiset(const value_type* __first, const value_type* __last,
- const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
-
- multiset(const_iterator __first, const_iterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_equal(__first, __last); }
-
- multiset(const_iterator __first, const_iterator __last,
- const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
multiset(const multiset<_Key,_Compare,_Alloc>& __x) : _M_t(__x._M_t) {}
+
multiset<_Key,_Compare,_Alloc>&
operator=(const multiset<_Key,_Compare,_Alloc>& __x) {
_M_t = __x._M_t;
return _M_t.insert_equal((_Rep_iterator&)__position, __x);
}
-#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last) {
_M_t.insert_equal(__first, __last);
}
-#else
- void insert(const value_type* __first, const value_type* __last) {
- _M_t.insert_equal(__first, __last);
- }
- void insert(const_iterator __first, const_iterator __last) {
- _M_t.insert_equal(__first, __last);
- }
-#endif /* __STL_MEMBER_TEMPLATES */
void erase(iterator __position) {
typedef typename _Rep_type::iterator _Rep_iterator;
_M_t.erase((_Rep_iterator&)__position);
return _M_t.equal_range(__x);
}
-#ifdef __STL_TEMPLATE_FRIENDS
template <class _K1, class _C1, class _A1>
friend bool operator== (const multiset<_K1,_C1,_A1>&,
const multiset<_K1,_C1,_A1>&);
template <class _K1, class _C1, class _A1>
friend bool operator< (const multiset<_K1,_C1,_A1>&,
const multiset<_K1,_C1,_A1>&);
-#else /* __STL_TEMPLATE_FRIENDS */
- friend bool __STD_QUALIFIER
- operator== __STL_NULL_TMPL_ARGS (const multiset&, const multiset&);
- friend bool __STD_QUALIFIER
- operator< __STL_NULL_TMPL_ARGS (const multiset&, const multiset&);
-#endif /* __STL_TEMPLATE_FRIENDS */
};
template <class _Key, class _Compare, class _Alloc>
return __x._M_t < __y._M_t;
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _Key, class _Compare, class _Alloc>
inline bool operator!=(const multiset<_Key,_Compare,_Alloc>& __x,
const multiset<_Key,_Compare,_Alloc>& __y) {
__x.swap(__y);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_MULTISET_H */
#ifndef _CPP_BITS_STL_NUMERIC_H
#define _CPP_BITS_STL_NUMERIC_H 1
-__STL_BEGIN_NAMESPACE
+namespace std
+{
template <class _InputIterator, class _Tp>
_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
*__first++ = __value++;
}
-__STL_END_NAMESPACE
+} // namespace std
#endif /* _CPP_BITS_STL_NUMERIC_H */
#ifndef __SGI_STL_INTERNAL_PAIR_H
#define __SGI_STL_INTERNAL_PAIR_H
-__STL_BEGIN_NAMESPACE
+namespace std
+{
template <class _T1, class _T2>
struct pair {
pair() : first(_T1()), second(_T2()) {}
pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
-#ifdef __STL_MEMBER_TEMPLATES
template <class _U1, class _U2>
pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
-#endif
};
template <class _T1, class _T2>
(!(__y.first < __x.first) && __x.second < __y.second);
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _T1, class _T2>
inline bool operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
return !(__x == __y);
return !(__x < __y);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
template <class _T1, class _T2>
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
//181. make_pair() unintended behavior
return pair<_T1, _T2>(__x, __y);
}
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_PAIR_H */
#include <bits/pthread_allocimpl.h>
-#ifdef __STL_USE_NAMESPACES
-
-using __STD::_Pthread_alloc_template;
-using __STD::pthread_alloc;
-
-#endif /* __STL_USE_NAMESPACES */
-
+using std::_Pthread_alloc_template;
+using std::pthread_alloc;
#endif /* _CPP_BITS_STL_PTHREAD_ALLOC_H */
#include <bits/sequence_concepts.h>
-__STL_BEGIN_NAMESPACE
+namespace std
+{
// Forward declarations of operators < and ==, needed for friend declaration.
__STL_CLASS_REQUIRES_SAME_TYPE(_Tp, _Sequence_value_type);
-#ifdef __STL_MEMBER_TEMPLATES
template <class _Tp1, class _Seq1>
friend bool operator== (const queue<_Tp1, _Seq1>&,
const queue<_Tp1, _Seq1>&);
template <class _Tp1, class _Seq1>
friend bool operator< (const queue<_Tp1, _Seq1>&,
const queue<_Tp1, _Seq1>&);
-#else /* __STL_MEMBER_TEMPLATES */
- friend bool __STD_QUALIFIER
- operator== __STL_NULL_TMPL_ARGS (const queue&, const queue&);
- friend bool __STD_QUALIFIER
- operator< __STL_NULL_TMPL_ARGS (const queue&, const queue&);
-#endif /* __STL_MEMBER_TEMPLATES */
-
public:
typedef typename _Sequence::value_type value_type;
typedef typename _Sequence::size_type size_type;
return __x.c < __y.c;
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _Tp, class _Sequence>
bool
operator!=(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
return !(__x < __y);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
template <class _Tp,
- class _Sequence __STL_DEPENDENT_DEFAULT_TMPL(vector<_Tp>),
- class _Compare
- __STL_DEPENDENT_DEFAULT_TMPL(less<typename _Sequence::value_type>) >
+ class _Sequence = vector<_Tp>,
+ class _Compare = less<typename _Sequence::value_type> >
class priority_queue {
public:
: c(__s), comp(__x)
{ make_heap(c.begin(), c.end(), comp); }
-#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
priority_queue(_InputIterator __first, _InputIterator __last)
: c(__first, __last) { make_heap(c.begin(), c.end(), comp); }
make_heap(c.begin(), c.end(), comp);
}
-#else /* __STL_MEMBER_TEMPLATES */
- priority_queue(const value_type* __first, const value_type* __last)
- : c(__first, __last) { make_heap(c.begin(), c.end(), comp); }
-
- priority_queue(const value_type* __first, const value_type* __last,
- const _Compare& __x)
- : c(__first, __last), comp(__x)
- { make_heap(c.begin(), c.end(), comp); }
-
- priority_queue(const value_type* __first, const value_type* __last,
- const _Compare& __x, const _Sequence& __c)
- : c(__c), comp(__x)
- {
- c.insert(c.end(), __first, __last);
- make_heap(c.begin(), c.end(), comp);
- }
-#endif /* __STL_MEMBER_TEMPLATES */
-
bool empty() const { return c.empty(); }
size_type size() const { return c.size(); }
const_reference top() const { return c.front(); }
// no equality is provided
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_QUEUE_H */
#ifndef _CPP_BITS_STL_RAW_STORAGE_ITERATOR_H
#define _CPP_BITS_STL_RAW_STORAGE_ITERATOR_H 1
-__STL_BEGIN_NAMESPACE
+namespace std
+{
template <class _ForwardIterator, class _Tp>
class raw_storage_iterator {
}
};
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _ForwardIterator, class _Tp>
-inline output_iterator_tag
-iterator_category(const raw_storage_iterator<_ForwardIterator, _Tp>&)
-{
- return output_iterator_tag();
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-__STL_END_NAMESPACE
+} // namespace std
#endif /* _CPP_BITS_STL_RAW_STORAGE_ITERATOR_H */
#ifndef _CPP_BITS_STL_RELOPS_H
#define _CPP_BITS_STL_RELOPS_H 1
-__STL_BEGIN_RELOPS_NAMESPACE
+namespace std
+{
+ namespace rel_ops
+ {
template <class _Tp>
inline bool operator!=(const _Tp& __x, const _Tp& __y) {
return !(__x < __y);
}
-__STL_END_RELOPS_NAMESPACE
+ } // namespace rel_ops
+} // namespace std
#endif /* _CPP_BITS_STL_RELOPS_H */
#include <bits/concept_checks.h>
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
+namespace std
+{
// Forward declarations of operators < and ==, needed for friend declaration.
const allocator_type& __a = allocator_type())
: _M_t(__comp, __a) {}
-#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
set(_InputIterator __first, _InputIterator __last)
: _M_t(_Compare(), allocator_type())
set(_InputIterator __first, _InputIterator __last, const _Compare& __comp,
const allocator_type& __a = allocator_type())
: _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
-#else
- set(const value_type* __first, const value_type* __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_unique(__first, __last); }
-
- set(const value_type* __first,
- const value_type* __last, const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
-
- set(const_iterator __first, const_iterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_unique(__first, __last); }
-
- set(const_iterator __first, const_iterator __last, const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
-#endif /* __STL_MEMBER_TEMPLATES */
set(const set<_Key,_Compare,_Alloc>& __x) : _M_t(__x._M_t) {}
set<_Key,_Compare,_Alloc>& operator=(const set<_Key, _Compare, _Alloc>& __x)
typedef typename _Rep_type::iterator _Rep_iterator;
return _M_t.insert_unique((_Rep_iterator&)__position, __x);
}
-#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last) {
_M_t.insert_unique(__first, __last);
}
-#else
- void insert(const_iterator __first, const_iterator __last) {
- _M_t.insert_unique(__first, __last);
- }
- void insert(const value_type* __first, const value_type* __last) {
- _M_t.insert_unique(__first, __last);
- }
-#endif /* __STL_MEMBER_TEMPLATES */
void erase(iterator __position) {
typedef typename _Rep_type::iterator _Rep_iterator;
_M_t.erase((_Rep_iterator&)__position);
return _M_t.equal_range(__x);
}
-#ifdef __STL_TEMPLATE_FRIENDS
template <class _K1, class _C1, class _A1>
friend bool operator== (const set<_K1,_C1,_A1>&, const set<_K1,_C1,_A1>&);
template <class _K1, class _C1, class _A1>
friend bool operator< (const set<_K1,_C1,_A1>&, const set<_K1,_C1,_A1>&);
-#else /* __STL_TEMPLATE_FRIENDS */
- friend bool __STD_QUALIFIER
- operator== __STL_NULL_TMPL_ARGS (const set&, const set&);
- friend bool __STD_QUALIFIER
- operator< __STL_NULL_TMPL_ARGS (const set&, const set&);
-#endif /* __STL_TEMPLATE_FRIENDS */
};
template <class _Key, class _Compare, class _Alloc>
return __x._M_t < __y._M_t;
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _Key, class _Compare, class _Alloc>
inline bool operator!=(const set<_Key,_Compare,_Alloc>& __x,
const set<_Key,_Compare,_Alloc>& __y) {
__x.swap(__y);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_SET_H */
#include <bits/sequence_concepts.h>
-__STL_BEGIN_NAMESPACE
+namespace std
+{
// Forward declarations of operators == and <, needed for friend declaration.
__STL_CLASS_REQUIRES_SAME_TYPE(_Tp, _Sequence_value_type);
-#ifdef __STL_MEMBER_TEMPLATES
template <class _Tp1, class _Seq1>
friend bool operator== (const stack<_Tp1, _Seq1>&,
const stack<_Tp1, _Seq1>&);
template <class _Tp1, class _Seq1>
friend bool operator< (const stack<_Tp1, _Seq1>&,
const stack<_Tp1, _Seq1>&);
-#else /* __STL_MEMBER_TEMPLATES */
- friend bool __STD_QUALIFIER
- operator== __STL_NULL_TMPL_ARGS (const stack&, const stack&);
- friend bool __STD_QUALIFIER
- operator< __STL_NULL_TMPL_ARGS (const stack&, const stack&);
-#endif /* __STL_MEMBER_TEMPLATES */
-
public:
typedef typename _Sequence::value_type value_type;
typedef typename _Sequence::size_type size_type;
return __x.c < __y.c;
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _Tp, class _Seq>
bool operator!=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
{
return !(__x < __y);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_STACK_H */
#ifndef __SGI_STL_INTERNAL_TEMPBUF_H
#define __SGI_STL_INTERNAL_TEMPBUF_H
-__STL_BEGIN_NAMESPACE
+namespace std
+{
template <class _Tp>
pair<_Tp*, ptrdiff_t>
return pair<_Tp*, ptrdiff_t>((_Tp*)0, 0);
}
-#ifdef __STL_EXPLICIT_FUNCTION_TMPL_ARGS
-
template <class _Tp>
inline pair<_Tp*, ptrdiff_t> get_temporary_buffer(ptrdiff_t __len) {
return __get_temporary_buffer(__len, (_Tp*) 0);
}
-#endif /* __STL_EXPLICIT_FUNCTION_TMPL_ARGS */
-
// This overload is not required by the standard; it is an extension.
// It is supported for backward compatibility with the HP STL, and
// because not all compilers support the language feature (explicit
_Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) {
// Workaround for a __type_traits bug in the pre-7.3 compiler.
-# if defined(__sgi) && !defined(__GNUC__) && _COMPILER_VERSION < 730
- typedef typename __type_traits<_Tp>::is_POD_type _Trivial;
-# else
typedef typename __type_traits<_Tp>::has_trivial_default_constructor
_Trivial;
-# endif
__STL_TRY {
_M_len = 0;
template <class _ForwardIterator,
class _Tp
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
= typename iterator_traits<_ForwardIterator>::value_type
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
>
struct temporary_buffer : public _Temporary_buffer<_ForwardIterator, _Tp>
{
~temporary_buffer() {}
};
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_TEMPBUF_H */
#include <windows.h>
#endif
-__STL_BEGIN_NAMESPACE
-
+namespace std
+{
// Class _Refcount_Base provides a type, _RC_t, a data member,
// _M_ref_count, and member functions _M_incr and _M_decr, which perform
_STL_auto_lock(const _STL_auto_lock&);
};
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_THREADS_H */
// mode:C++
// End:
-
-
-
-
#include <bits/stl_construct.h>
#include <bits/stl_function.h>
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1375
-#endif
+namespace std
+{
typedef bool _Rb_tree_Color_type;
const _Rb_tree_Color_type _S_rb_tree_red = false;
_Rb_tree_iterator(const iterator& __it) { _M_node = __it._M_node; }
reference operator*() const { return _Link_type(_M_node)->_M_value_field; }
-#ifndef __SGI_STL_NO_ARROW_OPERATOR
pointer operator->() const { return &(operator*()); }
-#endif /* __SGI_STL_NO_ARROW_OPERATOR */
_Self& operator++() { _M_increment(); return *this; }
_Self operator++(int) {
return __x._M_node != __y._M_node;
}
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-inline bidirectional_iterator_tag
-iterator_category(const _Rb_tree_base_iterator&) {
- return bidirectional_iterator_tag();
-}
-
-inline _Rb_tree_base_iterator::difference_type*
-distance_type(const _Rb_tree_base_iterator&) {
- return (_Rb_tree_base_iterator::difference_type*) 0;
-}
-
-template <class _Value, class _Ref, class _Ptr>
-inline _Value* value_type(const _Rb_tree_iterator<_Value, _Ref, _Ptr>&) {
- return (_Value*) 0;
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
inline void
_Rb_tree_rotate_left(_Rb_tree_node_base* __x, _Rb_tree_node_base*& __root)
{
else
__z->_M_parent->_M_right = __y;
__y->_M_parent = __z->_M_parent;
- __STD::swap(__y->_M_color, __z->_M_color);
+ std::swap(__y->_M_color, __z->_M_color);
__y = __z;
// __y now points to node to be actually deleted
}
// having an empty base class, we arbitrarily move one of rb_tree's
// data members into the base class.
-#ifdef __STL_USE_STD_ALLOCATORS
-
// _Base for general standard-conforming allocators.
template <class _Tp, class _Alloc, bool _S_instanceless>
class _Rb_tree_alloc_base {
};
-#else /* __STL_USE_STD_ALLOCATORS */
-
-template <class _Tp, class _Alloc>
-struct _Rb_tree_base
-{
- typedef _Alloc allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-
- _Rb_tree_base(const allocator_type&)
- : _M_header(0) { _M_header = _M_get_node(); }
- ~_Rb_tree_base() { _M_put_node(_M_header); }
-
-protected:
- _Rb_tree_node<_Tp>* _M_header;
-
- typedef simple_alloc<_Rb_tree_node<_Tp>, _Alloc> _Alloc_type;
-
- _Rb_tree_node<_Tp>* _M_get_node()
- { return _Alloc_type::allocate(1); }
- void _M_put_node(_Rb_tree_node<_Tp>* __p)
- { _Alloc_type::deallocate(__p, 1); }
-};
-
-#endif /* __STL_USE_STD_ALLOCATORS */
template <class _Key, class _Value, class _KeyOfValue, class _Compare,
class _Alloc = allocator<_Value> >
allocator_type get_allocator() const { return _Base::get_allocator(); }
protected:
-#ifdef __STL_USE_NAMESPACES
using _Base::_M_get_node;
using _Base::_M_put_node;
using _Base::_M_header;
-#endif /* __STL_USE_NAMESPACES */
protected:
typedef _Rb_tree_iterator<value_type, const_reference, const_pointer>
const_iterator;
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
typedef reverse_iterator<const_iterator> const_reverse_iterator;
typedef reverse_iterator<iterator> reverse_iterator;
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
- typedef reverse_bidirectional_iterator<iterator, value_type, reference,
- difference_type>
- reverse_iterator;
- typedef reverse_bidirectional_iterator<const_iterator, value_type,
- const_reference, difference_type>
- const_reverse_iterator;
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
private:
iterator _M_insert(_Base_ptr __x, _Base_ptr __y, const value_type& __v);
size_type max_size() const { return size_type(-1); }
void swap(_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __t) {
- __STD::swap(_M_header, __t._M_header);
- __STD::swap(_M_node_count, __t._M_node_count);
- __STD::swap(_M_key_compare, __t._M_key_compare);
+ std::swap(_M_header, __t._M_header);
+ std::swap(_M_node_count, __t._M_node_count);
+ std::swap(_M_key_compare, __t._M_key_compare);
}
public:
iterator insert_unique(iterator __position, const value_type& __x);
iterator insert_equal(iterator __position, const value_type& __x);
-#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
void insert_unique(_InputIterator __first, _InputIterator __last);
template <class _InputIterator>
void insert_equal(_InputIterator __first, _InputIterator __last);
-#else /* __STL_MEMBER_TEMPLATES */
- void insert_unique(const_iterator __first, const_iterator __last);
- void insert_unique(const value_type* __first, const value_type* __last);
- void insert_equal(const_iterator __first, const_iterator __last);
- void insert_equal(const value_type* __first, const value_type* __last);
-#endif /* __STL_MEMBER_TEMPLATES */
void erase(iterator __position);
size_type erase(const key_type& __x);
__y.begin(), __y.end());
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _Key, class _Value, class _KeyOfValue,
class _Compare, class _Alloc>
inline bool
__x.swap(__y);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
template <class _Key, class _Value, class _KeyOfValue,
class _Compare, class _Alloc>
}
}
-#ifdef __STL_MEMBER_TEMPLATES
-
template <class _Key, class _Val, class _KoV, class _Cmp, class _Alloc>
template<class _II>
void _Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc>
insert_unique(*__first);
}
-#else /* __STL_MEMBER_TEMPLATES */
-
-template <class _Key, class _Val, class _KoV, class _Cmp, class _Alloc>
-void
-_Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc>
- ::insert_equal(const _Val* __first, const _Val* __last)
-{
- for ( ; __first != __last; ++__first)
- insert_equal(*__first);
-}
-
-template <class _Key, class _Val, class _KoV, class _Cmp, class _Alloc>
-void
-_Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc>
- ::insert_equal(const_iterator __first, const_iterator __last)
-{
- for ( ; __first != __last; ++__first)
- insert_equal(*__first);
-}
-
-template <class _Key, class _Val, class _KoV, class _Cmp, class _Alloc>
-void
-_Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc>
- ::insert_unique(const _Val* __first, const _Val* __last)
-{
- for ( ; __first != __last; ++__first)
- insert_unique(*__first);
-}
-
-template <class _Key, class _Val, class _KoV, class _Cmp, class _Alloc>
-void _Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc>
- ::insert_unique(const_iterator __first, const_iterator __last)
-{
- for ( ; __first != __last; ++__first)
- insert_unique(*__first);
-}
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
template <class _Key, class _Value, class _KeyOfValue,
class _Compare, class _Alloc>
inline void _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>
~rb_tree() {}
};
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_TREE_H */
#include <bits/std_cstring.h>
-__STL_BEGIN_NAMESPACE
+namespace std
+{
// uninitialized_copy
__STL_UNWIND(_Destroy(__first2, __mid2));
}
-__STL_END_NAMESPACE
+} // namespace std
#endif /* _CPP_BITS_STL_UNINITIALIZED_H */
#define __SGI_STL_INTERNAL_VECTOR_H
#include <bits/functexcept.h>
-
#include <bits/concept_checks.h>
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
+namespace std
+{
// The vector base class serves two purposes. First, its constructor
// and destructor allocate (but don't initialize) storage. This makes
// the differences between SGI-style allocators and standard-conforming
// allocators.
-#ifdef __STL_USE_STD_ALLOCATORS
-
// Base class for ordinary allocators.
template <class _Tp, class _Allocator, bool _IsStatic>
class _Vector_alloc_base {
~_Vector_base() { _M_deallocate(_M_start, _M_end_of_storage - _M_start); }
};
-#else /* __STL_USE_STD_ALLOCATORS */
-
-template <class _Tp, class _Alloc>
-class _Vector_base {
-public:
- typedef _Alloc allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-
- _Vector_base(const _Alloc&)
- : _M_start(0), _M_finish(0), _M_end_of_storage(0) {}
- _Vector_base(size_t __n, const _Alloc&)
- : _M_start(0), _M_finish(0), _M_end_of_storage(0)
- {
- _M_start = _M_allocate(__n);
- _M_finish = _M_start;
- _M_end_of_storage = _M_start + __n;
- }
-
- ~_Vector_base() { _M_deallocate(_M_start, _M_end_of_storage - _M_start); }
-
-protected:
- _Tp* _M_start;
- _Tp* _M_finish;
- _Tp* _M_end_of_storage;
-
- typedef simple_alloc<_Tp, _Alloc> _M_data_allocator;
- _Tp* _M_allocate(size_t __n)
- { return _M_data_allocator::allocate(__n); }
- void _M_deallocate(_Tp* __p, size_t __n)
- { _M_data_allocator::deallocate(__p, __n); }
-};
-
-#endif /* __STL_USE_STD_ALLOCATORS */
template <class _Tp, class _Alloc = allocator<_Tp> >
class vector : protected _Vector_base<_Tp, _Alloc>
typedef typename _Base::allocator_type allocator_type;
allocator_type get_allocator() const { return _Base::get_allocator(); }
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
typedef reverse_iterator<const_iterator> const_reverse_iterator;
typedef reverse_iterator<iterator> reverse_iterator;
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
- typedef reverse_iterator<const_iterator, value_type, const_reference,
- difference_type> const_reverse_iterator;
- typedef reverse_iterator<iterator, value_type, reference, difference_type>
- reverse_iterator;
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
protected:
-#ifdef __STL_HAS_NAMESPACES
using _Base::_M_allocate;
using _Base::_M_deallocate;
using _Base::_M_start;
using _Base::_M_finish;
using _Base::_M_end_of_storage;
-#endif /* __STL_HAS_NAMESPACES */
protected:
void _M_insert_aux(iterator __position, const _Tp& __x);
reference operator[](size_type __n) { return *(begin() + __n); }
const_reference operator[](size_type __n) const { return *(begin() + __n); }
-#ifdef __STL_THROW_RANGE_ERRORS
void _M_range_check(size_type __n) const {
if (__n >= this->size())
__throw_out_of_range("vector");
{ _M_range_check(__n); return (*this)[__n]; }
const_reference at(size_type __n) const
{ _M_range_check(__n); return (*this)[__n]; }
-#endif /* __STL_THROW_RANGE_ERRORS */
explicit vector(const allocator_type& __a = allocator_type())
: _Base(__a) {}
: _Base(__x.size(), __x.get_allocator())
{ _M_finish = uninitialized_copy(__x.begin(), __x.end(), _M_start); }
-#ifdef __STL_MEMBER_TEMPLATES
// Check whether it's an integral type. If so, it's not an iterator.
template <class _InputIterator>
vector(_InputIterator __first, _InputIterator __last,
_M_range_initialize(__first, __last, __ITERATOR_CATEGORY(__first));
}
-#else
- vector(const _Tp* __first, const _Tp* __last,
- const allocator_type& __a = allocator_type())
- : _Base(__last - __first, __a)
- { _M_finish = uninitialized_copy(__first, __last, _M_start); }
-#endif /* __STL_MEMBER_TEMPLATES */
-
~vector() { destroy(_M_start, _M_finish); }
vector<_Tp, _Alloc>& operator=(const vector<_Tp, _Alloc>& __x);
void assign(size_type __n, const _Tp& __val) { _M_fill_assign(__n, __val); }
void _M_fill_assign(size_type __n, const _Tp& __val);
-#ifdef __STL_MEMBER_TEMPLATES
-
template <class _InputIterator>
void assign(_InputIterator __first, _InputIterator __last) {
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
forward_iterator_tag);
-#endif /* __STL_MEMBER_TEMPLATES */
-
reference front() { return *begin(); }
const_reference front() const { return *begin(); }
reference back() { return *(end() - 1); }
_M_insert_aux(end());
}
void swap(vector<_Tp, _Alloc>& __x) {
- __STD::swap(_M_start, __x._M_start);
- __STD::swap(_M_finish, __x._M_finish);
- __STD::swap(_M_end_of_storage, __x._M_end_of_storage);
+ std::swap(_M_start, __x._M_start);
+ std::swap(_M_finish, __x._M_finish);
+ std::swap(_M_end_of_storage, __x._M_end_of_storage);
}
iterator insert(iterator __position, const _Tp& __x) {
_M_insert_aux(iterator(__position));
return begin() + __n;
}
-#ifdef __STL_MEMBER_TEMPLATES
// Check whether it's an integral type. If so, it's not an iterator.
template <class _InputIterator>
void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
__false_type) {
_M_range_insert(__pos, __first, __last, __ITERATOR_CATEGORY(__first));
}
-#else /* __STL_MEMBER_TEMPLATES */
- void insert(iterator __position,
- const_iterator __first, const_iterator __last);
-#endif /* __STL_MEMBER_TEMPLATES */
void insert (iterator __pos, size_type __n, const _Tp& __x)
{ _M_fill_insert(__pos, __n, __x); }
protected:
-#ifdef __STL_MEMBER_TEMPLATES
template <class _ForwardIterator>
pointer _M_allocate_and_copy(size_type __n, _ForwardIterator __first,
_ForwardIterator __last)
-{
- pointer __result = _M_allocate(__n);
- __STL_TRY {
- uninitialized_copy(__first, __last, __result);
- return __result;
- }
- __STL_UNWIND(_M_deallocate(__result, __n));
- }
-#else /* __STL_MEMBER_TEMPLATES */
- pointer _M_allocate_and_copy(size_type __n, const_iterator __first,
- const_iterator __last)
{
- iterator __result(_M_allocate(__n));
+ pointer __result = _M_allocate(__n);
__STL_TRY {
uninitialized_copy(__first, __last, __result);
return __result;
}
__STL_UNWIND(_M_deallocate(__result, __n));
}
-#endif /* __STL_MEMBER_TEMPLATES */
-
-#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
void _M_range_initialize(_InputIterator __first,
_InputIterator __last, input_iterator_tag)
void _M_range_insert(iterator __pos,
_ForwardIterator __first, _ForwardIterator __last,
forward_iterator_tag);
-
-#endif /* __STL_MEMBER_TEMPLATES */
};
template <class _Tp, class _Alloc>
__y.begin(), __y.end());
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _Tp, class _Alloc>
inline void swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y)
{
return !(__x < __y);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
template <class _Tp, class _Alloc>
vector<_Tp,_Alloc>&
vector<_Tp,_Alloc>::operator=(const vector<_Tp, _Alloc>& __x)
erase(fill_n(begin(), __n, __val), end());
}
-#ifdef __STL_MEMBER_TEMPLATES
-
template <class _Tp, class _Alloc> template <class _InputIter>
void vector<_Tp, _Alloc>::_M_assign_aux(_InputIter __first, _InputIter __last,
input_iterator_tag) {
}
}
-#endif /* __STL_MEMBER_TEMPLATES */
-
template <class _Tp, class _Alloc>
void
vector<_Tp, _Alloc>::_M_insert_aux(iterator __position, const _Tp& __x)
}
}
-#ifdef __STL_MEMBER_TEMPLATES
-
template <class _Tp, class _Alloc> template <class _InputIterator>
void
vector<_Tp, _Alloc>::_M_range_insert(iterator __pos,
}
}
-#else /* __STL_MEMBER_TEMPLATES */
-
-template <class _Tp, class _Alloc>
-void
-vector<_Tp, _Alloc>::insert(iterator __position,
- const_iterator __first,
- const_iterator __last)
-{
- if (__first != __last) {
- size_type __n = 0;
- distance(__first, __last, __n);
- if (size_type(_M_end_of_storage - _M_finish) >= __n) {
- const size_type __elems_after = _M_finish - __position;
- iterator __old_finish(_M_finish);
- if (__elems_after > __n) {
- uninitialized_copy(_M_finish - __n, _M_finish, _M_finish);
- _M_finish += __n;
- copy_backward(__position, __old_finish - __n, __old_finish);
- copy(__first, __last, __position);
- }
- else {
- uninitialized_copy(__first + __elems_after, __last, _M_finish);
- _M_finish += __n - __elems_after;
- uninitialized_copy(__position, __old_finish, _M_finish);
- _M_finish += __elems_after;
- copy(__first, __first + __elems_after, __position);
- }
- }
- else {
- const size_type __old_size = size();
- const size_type __len = __old_size + max(__old_size, __n);
- iterator __new_start(_M_allocate(__len));
- iterator __new_finish(__new_start);
- __STL_TRY {
- __new_finish = uninitialized_copy(_M_start, __position, __new_start);
- __new_finish = uninitialized_copy(__first, __last, __new_finish);
- __new_finish
- = uninitialized_copy(__position, _M_finish, __new_finish);
- }
- __STL_UNWIND((destroy(__new_start,__new_finish),
- _M_deallocate(__new_start,__len)));
- destroy(_M_start, _M_finish);
- _M_deallocate(_M_start, _M_end_of_storage - _M_start);
- _M_start = __new_start;
- _M_finish = __new_finish;
- _M_end_of_storage = __new_start + __len;
- }
- }
-}
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_VECTOR_H */
#endif // _CPP_BITS_STREAMBUF_TCC
-
-
-
-
};
+// Provide some specializations.
-// Provide some specializations. This is harmless for compilers that
-// have built-in __types_traits support, and essential for compilers
-// that don't.
-
-#ifndef __STL_NO_BOOL
-
-__STL_TEMPLATE_NULL struct __type_traits<bool> {
+template<> struct __type_traits<bool> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type is_POD_type;
};
-#endif /* __STL_NO_BOOL */
-
-__STL_TEMPLATE_NULL struct __type_traits<char> {
+template<> struct __type_traits<char> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type is_POD_type;
};
-__STL_TEMPLATE_NULL struct __type_traits<signed char> {
+template<> struct __type_traits<signed char> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type is_POD_type;
};
-__STL_TEMPLATE_NULL struct __type_traits<unsigned char> {
+template<> struct __type_traits<unsigned char> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type is_POD_type;
};
-#ifdef __STL_HAS_WCHAR_T
-
-__STL_TEMPLATE_NULL struct __type_traits<wchar_t> {
+template<> struct __type_traits<wchar_t> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type is_POD_type;
};
-#endif /* __STL_HAS_WCHAR_T */
-
-__STL_TEMPLATE_NULL struct __type_traits<short> {
+template<> struct __type_traits<short> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type is_POD_type;
};
-__STL_TEMPLATE_NULL struct __type_traits<unsigned short> {
+template<> struct __type_traits<unsigned short> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type is_POD_type;
};
-__STL_TEMPLATE_NULL struct __type_traits<int> {
+template<> struct __type_traits<int> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type is_POD_type;
};
-__STL_TEMPLATE_NULL struct __type_traits<unsigned int> {
+template<> struct __type_traits<unsigned int> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type is_POD_type;
};
-__STL_TEMPLATE_NULL struct __type_traits<long> {
+template<> struct __type_traits<long> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type is_POD_type;
};
-__STL_TEMPLATE_NULL struct __type_traits<unsigned long> {
+template<> struct __type_traits<unsigned long> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type is_POD_type;
};
-#ifdef __STL_LONG_LONG
+#ifdef _GLIBCPP_USE_LONG_LONG
-__STL_TEMPLATE_NULL struct __type_traits<long long> {
+template<> struct __type_traits<long long> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type is_POD_type;
};
-__STL_TEMPLATE_NULL struct __type_traits<unsigned long long> {
+template<> struct __type_traits<unsigned long long> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type is_POD_type;
};
-#endif /* __STL_LONG_LONG */
+#endif /* _GLIBCPP_USE_LONG_LONG */
-__STL_TEMPLATE_NULL struct __type_traits<float> {
+template<> struct __type_traits<float> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type is_POD_type;
};
-__STL_TEMPLATE_NULL struct __type_traits<double> {
+template<> struct __type_traits<double> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type is_POD_type;
};
-__STL_TEMPLATE_NULL struct __type_traits<long double> {
+template<> struct __type_traits<long double> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type is_POD_type;
};
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
template <class _Tp>
struct __type_traits<_Tp*> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type is_POD_type;
};
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-__STL_TEMPLATE_NULL struct __type_traits<char*> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-__STL_TEMPLATE_NULL struct __type_traits<signed char*> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-__STL_TEMPLATE_NULL struct __type_traits<unsigned char*> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-__STL_TEMPLATE_NULL struct __type_traits<const char*> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-__STL_TEMPLATE_NULL struct __type_traits<const signed char*> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-__STL_TEMPLATE_NULL struct __type_traits<const unsigned char*> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
// The following could be written in terms of numeric_limits.
// We're doing it separately to reduce the number of dependencies.
typedef __false_type _Integral;
};
-#ifndef __STL_NO_BOOL
-
-__STL_TEMPLATE_NULL struct _Is_integer<bool> {
+template<> struct _Is_integer<bool> {
typedef __true_type _Integral;
};
-#endif /* __STL_NO_BOOL */
-
-__STL_TEMPLATE_NULL struct _Is_integer<char> {
+template<> struct _Is_integer<char> {
typedef __true_type _Integral;
};
-__STL_TEMPLATE_NULL struct _Is_integer<signed char> {
+template<> struct _Is_integer<signed char> {
typedef __true_type _Integral;
};
-__STL_TEMPLATE_NULL struct _Is_integer<unsigned char> {
+template<> struct _Is_integer<unsigned char> {
typedef __true_type _Integral;
};
-#ifdef __STL_HAS_WCHAR_T
-
-__STL_TEMPLATE_NULL struct _Is_integer<wchar_t> {
+template<> struct _Is_integer<wchar_t> {
typedef __true_type _Integral;
};
-#endif /* __STL_HAS_WCHAR_T */
-
-__STL_TEMPLATE_NULL struct _Is_integer<short> {
+template<> struct _Is_integer<short> {
typedef __true_type _Integral;
};
-__STL_TEMPLATE_NULL struct _Is_integer<unsigned short> {
+template<> struct _Is_integer<unsigned short> {
typedef __true_type _Integral;
};
-__STL_TEMPLATE_NULL struct _Is_integer<int> {
+template<> struct _Is_integer<int> {
typedef __true_type _Integral;
};
-__STL_TEMPLATE_NULL struct _Is_integer<unsigned int> {
+template<> struct _Is_integer<unsigned int> {
typedef __true_type _Integral;
};
-__STL_TEMPLATE_NULL struct _Is_integer<long> {
+template<> struct _Is_integer<long> {
typedef __true_type _Integral;
};
-__STL_TEMPLATE_NULL struct _Is_integer<unsigned long> {
+template<> struct _Is_integer<unsigned long> {
typedef __true_type _Integral;
};
-#ifdef __STL_LONG_LONG
+#ifdef _GLIBCPP_USE_LONG_LONG
-__STL_TEMPLATE_NULL struct _Is_integer<long long> {
+template<> struct _Is_integer<long long> {
typedef __true_type _Integral;
};
-__STL_TEMPLATE_NULL struct _Is_integer<unsigned long long> {
+template<> struct _Is_integer<unsigned long long> {
typedef __true_type _Integral;
};
-#endif /* __STL_LONG_LONG */
+#endif /* _GLIBCPP_USE_LONG_LONG */
template<typename _Tp> struct _Is_normal_iterator {
typedef __false_type _Normal;
// The template and inlines for the -*- C++ -*- internal _Meta class.
-// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
+// Copyright (C) 1997-1999, 2000, 2001 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
#pragma GCC system_header
-namespace std {
+namespace std
+{
//
// Implementing a loosened valarray return value is tricky.
#include <bits/std_vector.h>
#include <ext/stl_bvector.h>
-#ifdef __STL_USE_NAMESPACES
-
-using __STD::bit_vector;
-
-#endif /* __STL_USE_NAMESPACES */
+using std::bit_vector;
#endif /* __SGI_STL_BVECTOR_H */
#include <ext/stl_hashtable.h>
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
+namespace std
+{
// Forward declaration of equality operator; needed for friend declaration.
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
-#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
hash_map(_InputIterator __f, _InputIterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_unique(__f, __l); }
-#else
- hash_map(const value_type* __f, const value_type* __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const value_type* __f, const value_type* __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-
- hash_map(const_iterator __f, const_iterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const_iterator __f, const_iterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-#endif /*__STL_MEMBER_TEMPLATES */
-
public:
size_type size() const { return _M_ht.size(); }
size_type max_size() const { return _M_ht.max_size(); }
bool empty() const { return _M_ht.empty(); }
void swap(hash_map& __hs) { _M_ht.swap(__hs._M_ht); }
-#ifdef __STL_MEMBER_TEMPLATES
template <class _K1, class _T1, class _HF, class _EqK, class _Al>
friend bool operator== (const hash_map<_K1, _T1, _HF, _EqK, _Al>&,
const hash_map<_K1, _T1, _HF, _EqK, _Al>&);
-#else /* __STL_MEMBER_TEMPLATES */
- friend bool __STD_QUALIFIER
- operator== __STL_NULL_TMPL_ARGS (const hash_map&, const hash_map&);
-#endif /* __STL_MEMBER_TEMPLATES */
#include <bits/concept_checks.h>
public:
pair<iterator,bool> insert(const value_type& __obj)
{ return _M_ht.insert_unique(__obj); }
-#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
void insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_unique(__f,__l); }
-#else
- void insert(const value_type* __f, const value_type* __l) {
- _M_ht.insert_unique(__f,__l);
- }
- void insert(const_iterator __f, const_iterator __l)
- { _M_ht.insert_unique(__f, __l); }
-#endif /*__STL_MEMBER_TEMPLATES */
pair<iterator,bool> insert_noresize(const value_type& __obj)
{ return _M_ht.insert_unique_noresize(__obj); }
return __hm1._M_ht == __hm2._M_ht;
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
inline bool
operator!=(const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
__hm1.swap(__hm2);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
// Forward declaration of equality operator; needed for friend declaration.
template <class _Key, class _Tp,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
-#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
hash_multimap(_InputIterator __f, _InputIterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_equal(__f, __l); }
-#else
- hash_multimap(const value_type* __f, const value_type* __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const value_type* __f, const value_type* __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-
- hash_multimap(const_iterator __f, const_iterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const_iterator __f, const_iterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-#endif /*__STL_MEMBER_TEMPLATES */
-
public:
size_type size() const { return _M_ht.size(); }
size_type max_size() const { return _M_ht.max_size(); }
bool empty() const { return _M_ht.empty(); }
void swap(hash_multimap& __hs) { _M_ht.swap(__hs._M_ht); }
-#ifdef __STL_MEMBER_TEMPLATES
template <class _K1, class _T1, class _HF, class _EqK, class _Al>
friend bool operator== (const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&,
const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&);
-#else /* __STL_MEMBER_TEMPLATES */
- friend bool __STD_QUALIFIER
- operator== __STL_NULL_TMPL_ARGS (const hash_multimap&,const hash_multimap&);
-#endif /* __STL_MEMBER_TEMPLATES */
iterator begin() { return _M_ht.begin(); }
iterator end() { return _M_ht.end(); }
public:
iterator insert(const value_type& __obj)
{ return _M_ht.insert_equal(__obj); }
-#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
void insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_equal(__f,__l); }
-#else
- void insert(const value_type* __f, const value_type* __l) {
- _M_ht.insert_equal(__f,__l);
- }
- void insert(const_iterator __f, const_iterator __l)
- { _M_ht.insert_equal(__f, __l); }
-#endif /*__STL_MEMBER_TEMPLATES */
iterator insert_noresize(const value_type& __obj)
{ return _M_ht.insert_equal_noresize(__obj); }
return __hm1._M_ht == __hm2._M_ht;
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
inline bool
operator!=(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1,
__hm1.swap(__hm2);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
// Specialization of insert_iterator so that it will work for hash_map
// and hash_multimap.
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
class insert_iterator<hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
protected:
insert_iterator<_Container>& operator++(int) { return *this; }
};
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_HASH_MAP_H */
#include <bits/concept_checks.h>
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
+namespace std
+{
// Forward declaration of equality operator; needed for friend declaration.
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
-#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
hash_set(_InputIterator __f, _InputIterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_unique(__f, __l); }
-#else
-
- hash_set(const value_type* __f, const value_type* __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const value_type* __f, const value_type* __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-
- hash_set(const_iterator __f, const_iterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const_iterator __f, const_iterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-#endif /*__STL_MEMBER_TEMPLATES */
public:
size_type size() const { return _M_ht.size(); }
bool empty() const { return _M_ht.empty(); }
void swap(hash_set& __hs) { _M_ht.swap(__hs._M_ht); }
-#ifdef __STL_MEMBER_TEMPLATES
template <class _Val, class _HF, class _EqK, class _Al>
friend bool operator== (const hash_set<_Val, _HF, _EqK, _Al>&,
const hash_set<_Val, _HF, _EqK, _Al>&);
-#else /* __STL_MEMBER_TEMPLATES */
- friend bool __STD_QUALIFIER
- operator== __STL_NULL_TMPL_ARGS (const hash_set&, const hash_set&);
-#endif /* __STL_MEMBER_TEMPLATES */
iterator begin() const { return _M_ht.begin(); }
iterator end() const { return _M_ht.end(); }
pair<typename _Ht::iterator, bool> __p = _M_ht.insert_unique(__obj);
return pair<iterator,bool>(__p.first, __p.second);
}
-#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
void insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_unique(__f,__l); }
-#else
- void insert(const value_type* __f, const value_type* __l) {
- _M_ht.insert_unique(__f,__l);
- }
- void insert(const_iterator __f, const_iterator __l)
- {_M_ht.insert_unique(__f, __l); }
-#endif /*__STL_MEMBER_TEMPLATES */
pair<iterator, bool> insert_noresize(const value_type& __obj)
{
pair<typename _Ht::iterator, bool> __p =
return __hs1._M_ht == __hs2._M_ht;
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
inline bool
operator!=(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
__hs1.swap(__hs2);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
template <class _Value,
class _HashFcn = hash<_Value>,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {}
-#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
hash_multiset(_InputIterator __f, _InputIterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_equal(__f, __l); }
-#else
-
- hash_multiset(const value_type* __f, const value_type* __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const value_type* __f, const value_type* __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-
- hash_multiset(const_iterator __f, const_iterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const_iterator __f, const_iterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-#endif /*__STL_MEMBER_TEMPLATES */
public:
size_type size() const { return _M_ht.size(); }
bool empty() const { return _M_ht.empty(); }
void swap(hash_multiset& hs) { _M_ht.swap(hs._M_ht); }
-#ifdef __STL_MEMBER_TEMPLATES
template <class _Val, class _HF, class _EqK, class _Al>
friend bool operator== (const hash_multiset<_Val, _HF, _EqK, _Al>&,
const hash_multiset<_Val, _HF, _EqK, _Al>&);
-#else /* __STL_MEMBER_TEMPLATES */
- friend bool __STD_QUALIFIER
- operator== __STL_NULL_TMPL_ARGS (const hash_multiset&,const hash_multiset&);
-#endif /* __STL_MEMBER_TEMPLATES */
iterator begin() const { return _M_ht.begin(); }
iterator end() const { return _M_ht.end(); }
public:
iterator insert(const value_type& __obj)
{ return _M_ht.insert_equal(__obj); }
-#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
void insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_equal(__f,__l); }
-#else
- void insert(const value_type* __f, const value_type* __l) {
- _M_ht.insert_equal(__f,__l);
- }
- void insert(const_iterator __f, const_iterator __l)
- { _M_ht.insert_equal(__f, __l); }
-#endif /*__STL_MEMBER_TEMPLATES */
iterator insert_noresize(const value_type& __obj)
{ return _M_ht.insert_equal_noresize(__obj); }
return __hs1._M_ht == __hs2._M_ht;
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
inline bool
operator!=(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
__hs1.swap(__hs2);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
// Specialization of insert_iterator so that it will work for hash_set
// and hash_multiset.
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
class insert_iterator<hash_set<_Value, _HashFcn, _EqualKey, _Alloc> > {
protected:
insert_iterator<_Container>& operator++(int) { return *this; }
};
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_HASH_SET_H */
* You should not attempt to use it directly.
*/
-# include <bits/std_cstdio.h>
-
-#ifdef __STL_USE_NEW_IOSTREAMS
-# include <iostream>
-#else /* __STL_USE_NEW_IOSTREAMS */
-# include <bits/std_iostream.h>
-#endif /* __STL_USE_NEW_IOSTREAMS */
+#include <bits/std_cstdio.h>
+#include <bits/std_iostream.h>
#ifdef __STL_USE_EXCEPTIONS
# include <bits/std_stdexcept.h>
#endif
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#endif
+namespace std
+{
// Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf
// if necessary. Assumes _M_path_end[leaf_index] and leaf_pos are correct.
template <class _CharT, class _Alloc>
-#ifdef __STL_USE_STD_ALLOCATORS
inline void _Rope_RopeRep<_CharT,_Alloc>::_S_free_string(_CharT* __s,
size_t __n,
allocator_type __a)
-#else
- inline void _Rope_RopeRep<_CharT,_Alloc>::_S_free_string(_CharT* __s,
- size_t __n)
-#endif
{
if (!_S_is_basic_char_type((_CharT*)0)) {
destroy(__s, __s + __n);
}
// This has to be a static member, so this gets a bit messy
-# ifdef __STL_USE_STD_ALLOCATORS
__a.deallocate(
__s, _Rope_RopeLeaf<_CharT,_Alloc>::_S_rounded_up_size(__n));
-# else
- _Data_deallocate(
- __s, _Rope_RopeLeaf<_CharT,_Alloc>::_S_rounded_up_size(__n));
-# endif
}
#else
template <class _CharT, class _Alloc>
-#ifdef __STL_USE_STD_ALLOCATORS
inline void _Rope_RopeRep<_CharT,_Alloc>::_S_free_string
(const _CharT*, size_t, allocator_type)
-#else
- inline void _Rope_RopeRep<_CharT,_Alloc>::_S_free_string
- (const _CharT*, size_t)
-#endif
{}
#endif
_S_new_RopeConcatenation(__left, __right, __left->get_allocator());
size_t __depth = __result->_M_depth;
-# ifdef __STL_USE_STD_ALLOCATORS
__stl_assert(__left->get_allocator() == __right->get_allocator());
-# endif
if (__depth > 20 && (__result->_M_size < 1000 ||
__depth > _RopeRep::_S_max_rope_depth)) {
_RopeRep* __balanced;
}
};
-#ifdef __STL_USE_NEW_IOSTREAMS
template<class _CharT, class _Traits>
// Here _CharT is both the stream and rope character type.
-#else
- template<class _CharT>
- // Here _CharT is the rope character type. Unlike in the
- // above case, we somewhat handle the case in which it doesn't
- // match the stream character type, i.e. char.
-#endif
class _Rope_insert_char_consumer : public _Rope_char_consumer<_CharT> {
private:
-# ifdef __STL_USE_NEW_IOSTREAMS
typedef basic_ostream<_CharT,_Traits> _Insert_ostream;
-# else
- typedef ostream _Insert_ostream;
-# endif
_Insert_ostream& _M_o;
public:
_Rope_insert_char_consumer(_Insert_ostream& __writer)
// Returns true to continue traversal.
};
-#ifdef __STL_USE_NEW_IOSTREAMS
- template<class _CharT, class _Traits>
- bool _Rope_insert_char_consumer<_CharT, _Traits>::operator()
- (const _CharT* __leaf, size_t __n)
- {
- size_t __i;
- // We assume that formatting is set up correctly for each element.
- for (__i = 0; __i < __n; __i++) _M_o.put(__leaf[__i]);
- return true;
- }
-
-#else
- template<class _CharT>
- bool _Rope_insert_char_consumer<_CharT>::operator()
- (const _CharT* __leaf, size_t __n)
- {
- size_t __i;
- // We assume that formatting is set up correctly for each element.
- for (__i = 0; __i < __n; __i++) _M_o << __leaf[__i];
- return true;
- }
-
-
- __STL_TEMPLATE_NULL
- inline bool _Rope_insert_char_consumer<char>::operator()
- (const char* __leaf, size_t __n)
- {
- size_t __i;
- for (__i = 0; __i < __n; __i++) _M_o.put(__leaf[__i]);
- return true;
- }
-#endif
+template<class _CharT, class _Traits>
+bool _Rope_insert_char_consumer<_CharT, _Traits>::operator()
+ (const _CharT* __leaf, size_t __n)
+{
+ size_t __i;
+ // We assume that formatting is set up correctly for each element.
+ for (__i = 0; __i < __n; __i++) _M_o.put(__leaf[__i]);
+ return true;
+}
template <class _CharT, class _Alloc>
bool rope<_CharT, _Alloc>::_S_apply_to_pieces(
}
}
-#ifdef __STL_USE_NEW_IOSTREAMS
template<class _CharT, class _Traits>
inline void _Rope_fill(basic_ostream<_CharT, _Traits>& __o, size_t __n)
-#else
- inline void _Rope_fill(ostream& __o, size_t __n)
-#endif
{
char __f = __o.fill();
size_t __i;
inline bool _Rope_is_simple(char*) { return true; }
inline bool _Rope_is_simple(wchar_t*) { return true; }
-#ifdef __STL_USE_NEW_IOSTREAMS
- template<class _CharT, class _Traits, class _Alloc>
- basic_ostream<_CharT, _Traits>& operator<<
- (basic_ostream<_CharT, _Traits>& __o,
- const rope<_CharT, _Alloc>& __r)
-#else
- template<class _CharT, class _Alloc>
- ostream& operator<< (ostream& __o, const rope<_CharT, _Alloc>& __r)
-#endif
+template<class _CharT, class _Traits, class _Alloc>
+basic_ostream<_CharT, _Traits>& operator<< (basic_ostream<_CharT, _Traits>& __o,
+ const rope<_CharT, _Alloc>& __r)
{
size_t __w = __o.width();
bool __left = bool(__o.flags() & ios::left);
size_t __pad_len;
size_t __rope_len = __r.size();
-# ifdef __STL_USE_NEW_IOSTREAMS
_Rope_insert_char_consumer<_CharT, _Traits> __c(__o);
-# else
- _Rope_insert_char_consumer<_CharT> __c(__o);
-# endif
bool __is_simple = _Rope_is_simple((_CharT*)0);
if (__rope_len < __w) {
}
# endif
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#endif
-
-__STL_END_NAMESPACE
+} // namespace std
// Local Variables:
// mode:C++
#include <bits/concept_checks.h>
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
+namespace std
+{
struct _Slist_node_base
{
_Slist_iterator(const iterator& __x) : _Slist_iterator_base(__x._M_node) {}
reference operator*() const { return ((_Node*) _M_node)->_M_data; }
-#ifndef __SGI_STL_NO_ARROW_OPERATOR
pointer operator->() const { return &(operator*()); }
-#endif /* __SGI_STL_NO_ARROW_OPERATOR */
_Self& operator++()
{
}
};
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-inline ptrdiff_t* distance_type(const _Slist_iterator_base&) {
- return 0;
-}
-
-inline forward_iterator_tag iterator_category(const _Slist_iterator_base&) {
- return forward_iterator_tag();
-}
-
-template <class _Tp, class _Ref, class _Ptr>
-inline _Tp* value_type(const _Slist_iterator<_Tp, _Ref, _Ptr>&) {
- return 0;
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
// Base class that encapsulates details of allocators. Three cases:
// an ordinary standard-conforming allocator, a standard-conforming
// compatibility and because we want to avoid wasting storage on an
// allocator instance if it isn't necessary.
-#ifdef __STL_USE_STD_ALLOCATORS
-
// Base for general standard-conforming allocators.
template <class _Tp, class _Allocator, bool _IsStatic>
class _Slist_alloc_base {
_Slist_node_base* _M_erase_after(_Slist_node_base*, _Slist_node_base*);
};
-#else /* __STL_USE_STD_ALLOCATORS */
-
-template <class _Tp, class _Alloc>
-struct _Slist_base {
- typedef _Alloc allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-
- _Slist_base(const allocator_type&) { _M_head._M_next = 0; }
- ~_Slist_base() { _M_erase_after(&_M_head, 0); }
-
-protected:
- typedef simple_alloc<_Slist_node<_Tp>, _Alloc> _Alloc_type;
- _Slist_node<_Tp>* _M_get_node() { return _Alloc_type::allocate(1); }
- void _M_put_node(_Slist_node<_Tp>* __p) { _Alloc_type::deallocate(__p, 1); }
-
- _Slist_node_base* _M_erase_after(_Slist_node_base* __pos)
- {
- _Slist_node<_Tp>* __next = (_Slist_node<_Tp>*) (__pos->_M_next);
- _Slist_node_base* __next_next = __next->_M_next;
- __pos->_M_next = __next_next;
- destroy(&__next->_M_data);
- _M_put_node(__next);
- return __next_next;
- }
- _Slist_node_base* _M_erase_after(_Slist_node_base*, _Slist_node_base*);
-
-protected:
- _Slist_node_base _M_head;
-};
-
-#endif /* __STL_USE_STD_ALLOCATORS */
-
template <class _Tp, class _Alloc>
_Slist_node_base*
_Slist_base<_Tp,_Alloc>::_M_erase_after(_Slist_node_base* __before_first,
return __last_node;
}
-template <class _Tp, class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
+template <class _Tp, class _Alloc = allocator<_Tp> >
class slist : private _Slist_base<_Tp,_Alloc>
{
// requirements:
explicit slist(size_type __n) : _Base(allocator_type())
{ _M_insert_after_fill(&this->_M_head, __n, value_type()); }
-#ifdef __STL_MEMBER_TEMPLATES
// We don't need any dispatching tricks here, because _M_insert_after_range
// already does them.
template <class _InputIterator>
const allocator_type& __a = allocator_type()) : _Base(__a)
{ _M_insert_after_range(&this->_M_head, __first, __last); }
-#else /* __STL_MEMBER_TEMPLATES */
- slist(const_iterator __first, const_iterator __last,
- const allocator_type& __a = allocator_type()) : _Base(__a)
- { _M_insert_after_range(&this->_M_head, __first, __last); }
- slist(const value_type* __first, const value_type* __last,
- const allocator_type& __a = allocator_type()) : _Base(__a)
- { _M_insert_after_range(&this->_M_head, __first, __last); }
-#endif /* __STL_MEMBER_TEMPLATES */
-
slist(const slist& __x) : _Base(__x.get_allocator())
{ _M_insert_after_range(&this->_M_head, __x.begin(), __x.end()); }
void _M_fill_assign(size_type __n, const _Tp& __val);
-
-#ifdef __STL_MEMBER_TEMPLATES
-
template <class _InputIterator>
void assign(_InputIterator __first, _InputIterator __last) {
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
__false_type);
-#endif /* __STL_MEMBER_TEMPLATES */
-
public:
iterator begin() { return iterator((_Node*)this->_M_head._M_next); }
bool empty() const { return this->_M_head._M_next == 0; }
void swap(slist& __x)
- { __STD::swap(this->_M_head._M_next, __x._M_head._M_next); }
+ { std::swap(this->_M_head._M_next, __x._M_head._M_next); }
public:
__pos = __slist_make_link(__pos, _M_create_node(__x));
}
-#ifdef __STL_MEMBER_TEMPLATES
-
// Check whether it's an integral type. If so, it's not an iterator.
template <class _InIter>
void _M_insert_after_range(_Node_base* __pos,
}
}
-#else /* __STL_MEMBER_TEMPLATES */
-
- void _M_insert_after_range(_Node_base* __pos,
- const_iterator __first, const_iterator __last) {
- while (__first != __last) {
- __pos = __slist_make_link(__pos, _M_create_node(*__first));
- ++__first;
- }
- }
- void _M_insert_after_range(_Node_base* __pos,
- const value_type* __first,
- const value_type* __last) {
- while (__first != __last) {
- __pos = __slist_make_link(__pos, _M_create_node(*__first));
- ++__first;
- }
- }
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
public:
iterator insert_after(iterator __pos, const value_type& __x) {
_M_insert_after_fill(__pos._M_node, __n, __x);
}
-#ifdef __STL_MEMBER_TEMPLATES
-
// We don't need any dispatching tricks here, because _M_insert_after_range
// already does them.
template <class _InIter>
_M_insert_after_range(__pos._M_node, __first, __last);
}
-#else /* __STL_MEMBER_TEMPLATES */
-
- void insert_after(iterator __pos,
- const_iterator __first, const_iterator __last) {
- _M_insert_after_range(__pos._M_node, __first, __last);
- }
- void insert_after(iterator __pos,
- const value_type* __first, const value_type* __last) {
- _M_insert_after_range(__pos._M_node, __first, __last);
- }
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
iterator insert(iterator __pos, const value_type& __x) {
return iterator(_M_insert_after(__slist_previous(&this->_M_head,
__pos._M_node),
__n, __x);
}
-#ifdef __STL_MEMBER_TEMPLATES
-
// We don't need any dispatching tricks here, because _M_insert_after_range
// already does them.
template <class _InIter>
__first, __last);
}
-#else /* __STL_MEMBER_TEMPLATES */
-
- void insert(iterator __pos, const_iterator __first, const_iterator __last) {
- _M_insert_after_range(__slist_previous(&this->_M_head, __pos._M_node),
- __first, __last);
- }
- void insert(iterator __pos, const value_type* __first,
- const value_type* __last) {
- _M_insert_after_range(__slist_previous(&this->_M_head, __pos._M_node),
- __first, __last);
- }
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-
public:
iterator erase_after(iterator __pos) {
return iterator((_Node*) this->_M_erase_after(__pos._M_node));
void merge(slist& __x);
void sort();
-#ifdef __STL_MEMBER_TEMPLATES
template <class _Predicate>
void remove_if(_Predicate __pred);
template <class _StrictWeakOrdering>
void sort(_StrictWeakOrdering __comp);
-#endif /* __STL_MEMBER_TEMPLATES */
};
template <class _Tp, class _Alloc>
this->_M_erase_after(__prev, 0);
}
-#ifdef __STL_MEMBER_TEMPLATES
-
template <class _Tp, class _Alloc> template <class _InputIter>
void
slist<_Tp, _Alloc>::_M_assign_dispatch(_InputIter __first, _InputIter __last,
this->_M_erase_after(__prev, 0);
}
-#endif /* __STL_MEMBER_TEMPLATES */
-
template <class _Tp, class _Alloc>
inline bool
operator==(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2)
_SL2.begin(), _SL2.end());
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _Tp, class _Alloc>
inline bool
operator!=(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) {
__x.swap(__y);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
template <class _Tp, class _Alloc>
void slist<_Tp,_Alloc>::resize(size_type __len, const _Tp& __x)
}
}
-#ifdef __STL_MEMBER_TEMPLATES
-
template <class _Tp, class _Alloc>
template <class _Predicate>
void slist<_Tp,_Alloc>::remove_if(_Predicate __pred)
}
}
-#endif /* __STL_MEMBER_TEMPLATES */
-
// Specialization of insert_iterator so that insertions will be constant
// time rather than linear time.
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
template <class _Tp, class _Alloc>
class insert_iterator<slist<_Tp, _Alloc> > {
protected:
insert_iterator<_Container>& operator++(int) { return *this; }
};
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_SLIST_H */
#ifndef __SGI_STL_INTERNAL_BVECTOR_H
#define __SGI_STL_INTERNAL_BVECTOR_H
-__STL_BEGIN_NAMESPACE
+namespace std
+{
static const int __WORD_BIT = int(CHAR_BIT*sizeof(unsigned int));
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
-
struct _Bit_reference {
unsigned int* _M_p;
unsigned int _M_mask;
// Bit-vector base class, which encapsulates the difference between
// old SGI-style allocators and standard-conforming allocators.
-#ifdef __STL_USE_STD_ALLOCATORS
-
// Base class for ordinary allocators.
template <class _Allocator, bool __is_static>
class _Bvector_alloc_base {
~_Bvector_base() { _Base::_M_deallocate(); }
};
-#else /* __STL_USE_STD_ALLOCATORS */
+} // namespace std
-template <class _Alloc>
-class _Bvector_base
+// Declare a partial specialization of vector<T, Alloc>.
+#include <bits/stl_vector.h>
+namespace std
{
-public:
- typedef _Alloc allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-
- _Bvector_base(const allocator_type&)
- : _M_start(), _M_finish(), _M_end_of_storage(0) {}
- ~_Bvector_base() { _M_deallocate(); }
-protected:
- typedef simple_alloc<unsigned int, _Alloc> _Alloc_type;
+template <typename _Alloc>
+ class vector<bool, _Alloc> : public _Bvector_base<_Alloc>
+ {
+ public:
+ typedef bool value_type;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Bit_reference reference;
+ typedef bool const_reference;
+ typedef _Bit_reference* pointer;
+ typedef const bool* const_pointer;
- unsigned int* _M_bit_alloc(size_t __n)
- { return _Alloc_type::allocate((__n + __WORD_BIT - 1)/__WORD_BIT); }
- void _M_deallocate() {
- if (_M_start._M_p)
- _Alloc_type::deallocate(_M_start._M_p,
- _M_end_of_storage - _M_start._M_p);
- }
-
- _Bit_iterator _M_start;
- _Bit_iterator _M_finish;
- unsigned int* _M_end_of_storage;
-};
-
-#endif /* __STL_USE_STD_ALLOCATORS */
-
-// The next few lines are confusing. What we're doing is declaring a
-// partial specialization of vector<T, Alloc> if we have the necessary
-// compiler support. Otherwise, we define a class bit_vector which uses
-// the default allocator.
-
-#if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) && !defined(__STL_NO_BOOL)
-# define __SGI_STL_VECBOOL_TEMPLATE
-# define __BVECTOR vector<bool, _Alloc>
-# define __VECTOR vector
-# define __BVECTOR_BASE _Bvector_base<_Alloc>
-# define __BVECTOR_TMPL_LIST template <class _Alloc>
- __STL_END_NAMESPACE
-# include <bits/stl_vector.h>
- __STL_BEGIN_NAMESPACE
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION && !__STL_NO_BOOL */
-# undef __SGI_STL_VECBOOL_TEMPLATE
-# define __BVECTOR bit_vector
-# define __VECTOR bit_vector
-# define __BVECTOR_BASE _Bvector_base<__STL_DEFAULT_ALLOCATOR(bool) >
-# define __BVECTOR_TMPL_LIST
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION && !__STL_NO_BOOL */
-
-
-__BVECTOR_TMPL_LIST
-class __BVECTOR : public __BVECTOR_BASE
-{
-public:
- typedef bool value_type;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _Bit_reference reference;
- typedef bool const_reference;
- typedef _Bit_reference* pointer;
- typedef const bool* const_pointer;
-
- typedef _Bit_iterator iterator;
- typedef _Bit_const_iterator const_iterator;
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
- typedef reverse_iterator<const_iterator> const_reverse_iterator;
- typedef reverse_iterator<iterator> reverse_iterator;
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
- typedef reverse_iterator<const_iterator, value_type, const_reference,
- difference_type> const_reverse_iterator;
- typedef reverse_iterator<iterator, value_type, reference, difference_type>
- reverse_iterator;
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
- typedef typename __BVECTOR_BASE::allocator_type allocator_type;
- allocator_type get_allocator() const {
- return __BVECTOR_BASE::get_allocator();
- }
-
-protected:
-#ifdef __STL_USE_NAMESPACES
- using __BVECTOR_BASE::_M_bit_alloc;
- using __BVECTOR_BASE::_M_deallocate;
- using __BVECTOR_BASE::_M_start;
- using __BVECTOR_BASE::_M_finish;
- using __BVECTOR_BASE::_M_end_of_storage;
-#endif /* __STL_USE_NAMESPACES */
-
-protected:
- void _M_initialize(size_type __n) {
- unsigned int* __q = _M_bit_alloc(__n);
- _M_end_of_storage = __q + (__n + __WORD_BIT - 1)/__WORD_BIT;
- _M_start = iterator(__q, 0);
- _M_finish = _M_start + difference_type(__n);
- }
- void _M_insert_aux(iterator __position, bool __x) {
- if (_M_finish._M_p != _M_end_of_storage) {
- copy_backward(__position, _M_finish, _M_finish + 1);
- *__position = __x;
- ++_M_finish;
- }
- else {
- size_type __len = size() ? 2 * size() : __WORD_BIT;
- unsigned int* __q = _M_bit_alloc(__len);
- iterator __i = copy(begin(), __position, iterator(__q, 0));
- *__i++ = __x;
- _M_finish = copy(__position, end(), __i);
- _M_deallocate();
- _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
+ typedef _Bit_iterator iterator;
+ typedef _Bit_const_iterator const_iterator;
+
+ typedef reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef reverse_iterator<iterator> reverse_iterator;
+
+ typedef typename _Bvector_base<_Alloc>::allocator_type allocator_type;
+ allocator_type get_allocator() const {
+ return _Bvector_base<_Alloc>::get_allocator();
+ }
+
+ protected:
+ using _Bvector_base<_Alloc>::_M_bit_alloc;
+ using _Bvector_base<_Alloc>::_M_deallocate;
+ using _Bvector_base<_Alloc>::_M_start;
+ using _Bvector_base<_Alloc>::_M_finish;
+ using _Bvector_base<_Alloc>::_M_end_of_storage;
+
+ protected:
+ void _M_initialize(size_type __n) {
+ unsigned int* __q = _M_bit_alloc(__n);
+ _M_end_of_storage = __q + (__n + __WORD_BIT - 1)/__WORD_BIT;
_M_start = iterator(__q, 0);
+ _M_finish = _M_start + difference_type(__n);
}
- }
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- void _M_initialize_range(_InputIterator __first, _InputIterator __last,
- input_iterator_tag) {
- _M_start = iterator();
- _M_finish = iterator();
- _M_end_of_storage = 0;
- for ( ; __first != __last; ++__first)
- push_back(*__first);
- }
-
- template <class _ForwardIterator>
- void _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
- forward_iterator_tag) {
- size_type __n = 0;
- distance(__first, __last, __n);
- _M_initialize(__n);
- copy(__first, __last, _M_start);
- }
-
- template <class _InputIterator>
- void _M_insert_range(iterator __pos,
- _InputIterator __first, _InputIterator __last,
- input_iterator_tag) {
- for ( ; __first != __last; ++__first) {
- __pos = insert(__pos, *__first);
- ++__pos;
+ void _M_insert_aux(iterator __position, bool __x) {
+ if (_M_finish._M_p != _M_end_of_storage) {
+ copy_backward(__position, _M_finish, _M_finish + 1);
+ *__position = __x;
+ ++_M_finish;
+ }
+ else {
+ size_type __len = size() ? 2 * size() : __WORD_BIT;
+ unsigned int* __q = _M_bit_alloc(__len);
+ iterator __i = copy(begin(), __position, iterator(__q, 0));
+ *__i++ = __x;
+ _M_finish = copy(__position, end(), __i);
+ _M_deallocate();
+ _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
+ _M_start = iterator(__q, 0);
+ }
}
- }
-
- template <class _ForwardIterator>
- void _M_insert_range(iterator __position,
- _ForwardIterator __first, _ForwardIterator __last,
- forward_iterator_tag) {
- if (__first != __last) {
+
+ template <class _InputIterator>
+ void _M_initialize_range(_InputIterator __first, _InputIterator __last,
+ input_iterator_tag) {
+ _M_start = iterator();
+ _M_finish = iterator();
+ _M_end_of_storage = 0;
+ for ( ; __first != __last; ++__first)
+ push_back(*__first);
+ }
+
+ template <class _ForwardIterator>
+ void _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
+ forward_iterator_tag) {
size_type __n = 0;
distance(__first, __last, __n);
+ _M_initialize(__n);
+ copy(__first, __last, _M_start);
+ }
+
+ template <class _InputIterator>
+ void _M_insert_range(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ input_iterator_tag) {
+ for ( ; __first != __last; ++__first) {
+ __pos = insert(__pos, *__first);
+ ++__pos;
+ }
+ }
+
+ template <class _ForwardIterator>
+ void _M_insert_range(iterator __position,
+ _ForwardIterator __first, _ForwardIterator __last,
+ forward_iterator_tag) {
+ if (__first != __last) {
+ size_type __n = 0;
+ distance(__first, __last, __n);
+ if (capacity() - size() >= __n) {
+ copy_backward(__position, end(), _M_finish + difference_type(__n));
+ copy(__first, __last, __position);
+ _M_finish += difference_type(__n);
+ }
+ else {
+ size_type __len = size() + max(size(), __n);
+ unsigned int* __q = _M_bit_alloc(__len);
+ iterator __i = copy(begin(), __position, iterator(__q, 0));
+ __i = copy(__first, __last, __i);
+ _M_finish = copy(__position, end(), __i);
+ _M_deallocate();
+ _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
+ _M_start = iterator(__q, 0);
+ }
+ }
+ }
+
+ public:
+ iterator begin() { return _M_start; }
+ const_iterator begin() const { return _M_start; }
+ iterator end() { return _M_finish; }
+ const_iterator end() const { return _M_finish; }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const {
+ return const_reverse_iterator(end());
+ }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const {
+ return const_reverse_iterator(begin());
+ }
+
+ size_type size() const { return size_type(end() - begin()); }
+ size_type max_size() const { return size_type(-1); }
+ size_type capacity() const {
+ return size_type(const_iterator(_M_end_of_storage, 0) - begin());
+ }
+ bool empty() const { return begin() == end(); }
+
+ reference operator[](size_type __n)
+ { return *(begin() + difference_type(__n)); }
+ const_reference operator[](size_type __n) const
+ { return *(begin() + difference_type(__n)); }
+
+ void _M_range_check(size_type __n) const {
+ if (__n >= this->size())
+ __throw_range_error("vector<bool>");
+ }
+
+ reference at(size_type __n)
+ { _M_range_check(__n); return (*this)[__n]; }
+ const_reference at(size_type __n) const
+ { _M_range_check(__n); return (*this)[__n]; }
+
+ explicit vector(const allocator_type& __a = allocator_type())
+ : _Bvector_base<_Alloc>(__a) {}
+
+ vector(size_type __n, bool __value,
+ const allocator_type& __a = allocator_type())
+ : _Bvector_base<_Alloc>(__a)
+ {
+ _M_initialize(__n);
+ fill(_M_start._M_p, _M_end_of_storage, __value ? ~0 : 0);
+ }
+
+ explicit vector(size_type __n)
+ : _Bvector_base<_Alloc>(allocator_type())
+ {
+ _M_initialize(__n);
+ fill(_M_start._M_p, _M_end_of_storage, 0);
+ }
+
+ vector(const vector& __x) : _Bvector_base<_Alloc>(__x.get_allocator()) {
+ _M_initialize(__x.size());
+ copy(__x.begin(), __x.end(), _M_start);
+ }
+
+ // Check whether it's an integral type. If so, it's not an iterator.
+
+ template <class _Integer>
+ void _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) {
+ _M_initialize(__n);
+ fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0);
+ }
+
+ template <class _InputIterator>
+ void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
+ __false_type) {
+ _M_initialize_range(__first, __last, __ITERATOR_CATEGORY(__first));
+ }
+
+ template <class _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a = allocator_type())
+ : _Bvector_base<_Alloc>(__a)
+ {
+ typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
+ _M_initialize_dispatch(__first, __last, _Integral());
+ }
+
+ ~vector() { }
+
+ vector& operator=(const vector& __x) {
+ if (&__x == this) return *this;
+ if (__x.size() > capacity()) {
+ _M_deallocate();
+ _M_initialize(__x.size());
+ }
+ copy(__x.begin(), __x.end(), begin());
+ _M_finish = begin() + difference_type(__x.size());
+ return *this;
+ }
+
+ // assign(), a generalized assignment member function. Two
+ // versions: one that takes a count, and one that takes a range.
+ // The range version is a member template, so we dispatch on whether
+ // or not the type is an integer.
+
+ void _M_fill_assign(size_t __n, bool __x) {
+ if (__n > size()) {
+ fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0);
+ insert(end(), __n - size(), __x);
+ }
+ else {
+ erase(begin() + __n, end());
+ fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0);
+ }
+ }
+
+ void assign(size_t __n, bool __x) { _M_fill_assign(__n, __x); }
+
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
+ { _M_fill_assign((size_t) __n, (bool) __val); }
+
+ template <class _InputIter>
+ void _M_assign_dispatch(_InputIter __first, _InputIter __last, __false_type)
+ { _M_assign_aux(__first, __last, __ITERATOR_CATEGORY(__first)); }
+
+ template <class _InputIterator>
+ void _M_assign_aux(_InputIterator __first, _InputIterator __last,
+ input_iterator_tag) {
+ iterator __cur = begin();
+ for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
+ *__cur = *__first;
+ if (__first == __last)
+ erase(__cur, end());
+ else
+ insert(end(), __first, __last);
+ }
+
+ template <class _ForwardIterator>
+ void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
+ forward_iterator_tag) {
+ size_type __len = 0;
+ distance(__first, __last, __len);
+ if (__len < size())
+ erase(copy(__first, __last, begin()), end());
+ else {
+ _ForwardIterator __mid = __first;
+ advance(__mid, size());
+ copy(__first, __mid, begin());
+ insert(end(), __mid, __last);
+ }
+ }
+
+ void reserve(size_type __n) {
+ if (capacity() < __n) {
+ unsigned int* __q = _M_bit_alloc(__n);
+ _M_finish = copy(begin(), end(), iterator(__q, 0));
+ _M_deallocate();
+ _M_start = iterator(__q, 0);
+ _M_end_of_storage = __q + (__n + __WORD_BIT - 1)/__WORD_BIT;
+ }
+ }
+
+ reference front() { return *begin(); }
+ const_reference front() const { return *begin(); }
+ reference back() { return *(end() - 1); }
+ const_reference back() const { return *(end() - 1); }
+ void push_back(bool __x) {
+ if (_M_finish._M_p != _M_end_of_storage)
+ *_M_finish++ = __x;
+ else
+ _M_insert_aux(end(), __x);
+ }
+ void swap(vector<bool, _Alloc>& __x) {
+ std::swap(_M_start, __x._M_start);
+ std::swap(_M_finish, __x._M_finish);
+ std::swap(_M_end_of_storage, __x._M_end_of_storage);
+ }
+ iterator insert(iterator __position, bool __x = bool()) {
+ difference_type __n = __position - begin();
+ if (_M_finish._M_p != _M_end_of_storage && __position == end())
+ *_M_finish++ = __x;
+ else
+ _M_insert_aux(__position, __x);
+ return begin() + __n;
+ }
+
+ // Check whether it's an integral type. If so, it's not an iterator.
+
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
+ __true_type) {
+ _M_fill_insert(__pos, __n, __x);
+ }
+
+ template <class _InputIterator>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ __false_type) {
+ _M_insert_range(__pos, __first, __last, __ITERATOR_CATEGORY(__first));
+ }
+
+ template <class _InputIterator>
+ void insert(iterator __position,
+ _InputIterator __first, _InputIterator __last) {
+ typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
+ _M_insert_dispatch(__position, __first, __last, _Integral());
+ }
+
+ void _M_fill_insert(iterator __position, size_type __n, bool __x) {
+ if (__n == 0) return;
if (capacity() - size() >= __n) {
copy_backward(__position, end(), _M_finish + difference_type(__n));
- copy(__first, __last, __position);
+ fill(__position, __position + difference_type(__n), __x);
_M_finish += difference_type(__n);
}
else {
size_type __len = size() + max(size(), __n);
unsigned int* __q = _M_bit_alloc(__len);
iterator __i = copy(begin(), __position, iterator(__q, 0));
- __i = copy(__first, __last, __i);
- _M_finish = copy(__position, end(), __i);
+ fill_n(__i, __n, __x);
+ _M_finish = copy(__position, end(), __i + difference_type(__n));
_M_deallocate();
_M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
_M_start = iterator(__q, 0);
}
}
- }
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-public:
- iterator begin() { return _M_start; }
- const_iterator begin() const { return _M_start; }
- iterator end() { return _M_finish; }
- const_iterator end() const { return _M_finish; }
-
- reverse_iterator rbegin() { return reverse_iterator(end()); }
- const_reverse_iterator rbegin() const {
- return const_reverse_iterator(end());
- }
- reverse_iterator rend() { return reverse_iterator(begin()); }
- const_reverse_iterator rend() const {
- return const_reverse_iterator(begin());
- }
-
- size_type size() const { return size_type(end() - begin()); }
- size_type max_size() const { return size_type(-1); }
- size_type capacity() const {
- return size_type(const_iterator(_M_end_of_storage, 0) - begin());
- }
- bool empty() const { return begin() == end(); }
-
- reference operator[](size_type __n)
- { return *(begin() + difference_type(__n)); }
- const_reference operator[](size_type __n) const
- { return *(begin() + difference_type(__n)); }
-
-#ifdef __STL_THROW_RANGE_ERRORS
- void _M_range_check(size_type __n) const {
- if (__n >= this->size())
- __throw_range_error("vector<bool>");
- }
-
- reference at(size_type __n)
- { _M_range_check(__n); return (*this)[__n]; }
- const_reference at(size_type __n) const
- { _M_range_check(__n); return (*this)[__n]; }
-#endif /* __STL_THROW_RANGE_ERRORS */
-
- explicit __VECTOR(const allocator_type& __a = allocator_type())
- : __BVECTOR_BASE(__a) {}
-
- __VECTOR(size_type __n, bool __value,
- const allocator_type& __a = allocator_type())
- : __BVECTOR_BASE(__a)
- {
- _M_initialize(__n);
- fill(_M_start._M_p, _M_end_of_storage, __value ? ~0 : 0);
- }
-
- explicit __VECTOR(size_type __n)
- : __BVECTOR_BASE(allocator_type())
- {
- _M_initialize(__n);
- fill(_M_start._M_p, _M_end_of_storage, 0);
- }
-
- __VECTOR(const __VECTOR& __x) : __BVECTOR_BASE(__x.get_allocator()) {
- _M_initialize(__x.size());
- copy(__x.begin(), __x.end(), _M_start);
- }
-
-#ifdef __STL_MEMBER_TEMPLATES
-
- // Check whether it's an integral type. If so, it's not an iterator.
-
- template <class _Integer>
- void _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) {
- _M_initialize(__n);
- fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0);
- }
-
- template <class _InputIterator>
- void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
- __false_type) {
- _M_initialize_range(__first, __last, __ITERATOR_CATEGORY(__first));
- }
-
- template <class _InputIterator>
- __VECTOR(_InputIterator __first, _InputIterator __last,
- const allocator_type& __a = allocator_type())
- : __BVECTOR_BASE(__a)
- {
- typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
- _M_initialize_dispatch(__first, __last, _Integral());
- }
-
-#else /* __STL_MEMBER_TEMPLATES */
-
- __VECTOR(const_iterator __first, const_iterator __last,
- const allocator_type& __a = allocator_type())
- : __BVECTOR_BASE(__a)
- {
- size_type __n = 0;
- distance(__first, __last, __n);
- _M_initialize(__n);
- copy(__first, __last, _M_start);
- }
- __VECTOR(const bool* __first, const bool* __last,
- const allocator_type& __a = allocator_type())
- : __BVECTOR_BASE(__a)
- {
- size_type __n = 0;
- distance(__first, __last, __n);
- _M_initialize(__n);
- copy(__first, __last, _M_start);
- }
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
- ~__VECTOR() { }
-
- __VECTOR& operator=(const __VECTOR& __x) {
- if (&__x == this) return *this;
- if (__x.size() > capacity()) {
- _M_deallocate();
- _M_initialize(__x.size());
- }
- copy(__x.begin(), __x.end(), begin());
- _M_finish = begin() + difference_type(__x.size());
- return *this;
- }
-
- // assign(), a generalized assignment member function. Two
- // versions: one that takes a count, and one that takes a range.
- // The range version is a member template, so we dispatch on whether
- // or not the type is an integer.
-
- void _M_fill_assign(size_t __n, bool __x) {
- if (__n > size()) {
- fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0);
- insert(end(), __n - size(), __x);
- }
- else {
- erase(begin() + __n, end());
- fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0);
+
+ void insert(iterator __position, size_type __n, bool __x) {
+ _M_fill_insert(__position, __n, __x);
}
- }
-
- void assign(size_t __n, bool __x) { _M_fill_assign(__n, __x); }
-
-#ifdef __STL_MEMBER_TEMPLATES
-
- template <class _InputIterator>
- void assign(_InputIterator __first, _InputIterator __last) {
- typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
- _M_assign_dispatch(__first, __last, _Integral());
- }
-
- template <class _Integer>
- void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
- { _M_fill_assign((size_t) __n, (bool) __val); }
-
- template <class _InputIter>
- void _M_assign_dispatch(_InputIter __first, _InputIter __last, __false_type)
- { _M_assign_aux(__first, __last, __ITERATOR_CATEGORY(__first)); }
-
- template <class _InputIterator>
- void _M_assign_aux(_InputIterator __first, _InputIterator __last,
- input_iterator_tag) {
- iterator __cur = begin();
- for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
- *__cur = *__first;
- if (__first == __last)
- erase(__cur, end());
- else
- insert(end(), __first, __last);
- }
-
- template <class _ForwardIterator>
- void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
- forward_iterator_tag) {
- size_type __len = 0;
- distance(__first, __last, __len);
- if (__len < size())
- erase(copy(__first, __last, begin()), end());
- else {
- _ForwardIterator __mid = __first;
- advance(__mid, size());
- copy(__first, __mid, begin());
- insert(end(), __mid, __last);
- }
- }
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
- void reserve(size_type __n) {
- if (capacity() < __n) {
- unsigned int* __q = _M_bit_alloc(__n);
- _M_finish = copy(begin(), end(), iterator(__q, 0));
- _M_deallocate();
- _M_start = iterator(__q, 0);
- _M_end_of_storage = __q + (__n + __WORD_BIT - 1)/__WORD_BIT;
+
+ void pop_back() { --_M_finish; }
+ iterator erase(iterator __position) {
+ if (__position + 1 != end())
+ copy(__position + 1, end(), __position);
+ --_M_finish;
+ return __position;
}
- }
-
- reference front() { return *begin(); }
- const_reference front() const { return *begin(); }
- reference back() { return *(end() - 1); }
- const_reference back() const { return *(end() - 1); }
- void push_back(bool __x) {
- if (_M_finish._M_p != _M_end_of_storage)
- *_M_finish++ = __x;
- else
- _M_insert_aux(end(), __x);
- }
- void swap(__BVECTOR& __x) {
- __STD::swap(_M_start, __x._M_start);
- __STD::swap(_M_finish, __x._M_finish);
- __STD::swap(_M_end_of_storage, __x._M_end_of_storage);
- }
- iterator insert(iterator __position, bool __x = bool()) {
- difference_type __n = __position - begin();
- if (_M_finish._M_p != _M_end_of_storage && __position == end())
- *_M_finish++ = __x;
- else
- _M_insert_aux(__position, __x);
- return begin() + __n;
- }
-
-#ifdef __STL_MEMBER_TEMPLATES
- // Check whether it's an integral type. If so, it's not an iterator.
-
- template <class _Integer>
- void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
- __true_type) {
- _M_fill_insert(__pos, __n, __x);
- }
-
- template <class _InputIterator>
- void _M_insert_dispatch(iterator __pos,
- _InputIterator __first, _InputIterator __last,
- __false_type) {
- _M_insert_range(__pos, __first, __last, __ITERATOR_CATEGORY(__first));
- }
-
- template <class _InputIterator>
- void insert(iterator __position,
- _InputIterator __first, _InputIterator __last) {
- typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
- _M_insert_dispatch(__position, __first, __last, _Integral());
- }
-
-#else /* __STL_MEMBER_TEMPLATES */
- void insert(iterator __position,
- const_iterator __first, const_iterator __last) {
- if (__first == __last) return;
- size_type __n = 0;
- distance(__first, __last, __n);
- if (capacity() - size() >= __n) {
- copy_backward(__position, end(), _M_finish + __n);
- copy(__first, __last, __position);
- _M_finish += __n;
- }
- else {
- size_type __len = size() + max(size(), __n);
- unsigned int* __q = _M_bit_alloc(__len);
- iterator __i = copy(begin(), __position, iterator(__q, 0));
- __i = copy(__first, __last, __i);
- _M_finish = copy(__position, end(), __i);
- _M_deallocate();
- _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
- _M_start = iterator(__q, 0);
+ iterator erase(iterator __first, iterator __last) {
+ _M_finish = copy(__last, end(), __first);
+ return __first;
}
- }
-
- void insert(iterator __position, const bool* __first, const bool* __last) {
- if (__first == __last) return;
- size_type __n = 0;
- distance(__first, __last, __n);
- if (capacity() - size() >= __n) {
- copy_backward(__position, end(), _M_finish + __n);
- copy(__first, __last, __position);
- _M_finish += __n;
- }
- else {
- size_type __len = size() + max(size(), __n);
- unsigned int* __q = _M_bit_alloc(__len);
- iterator __i = copy(begin(), __position, iterator(__q, 0));
- __i = copy(__first, __last, __i);
- _M_finish = copy(__position, end(), __i);
- _M_deallocate();
- _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
- _M_start = iterator(__q, 0);
+ void resize(size_type __new_size, bool __x = bool()) {
+ if (__new_size < size())
+ erase(begin() + difference_type(__new_size), end());
+ else
+ insert(end(), __new_size - size(), __x);
}
- }
-#endif /* __STL_MEMBER_TEMPLATES */
-
- void _M_fill_insert(iterator __position, size_type __n, bool __x) {
- if (__n == 0) return;
- if (capacity() - size() >= __n) {
- copy_backward(__position, end(), _M_finish + difference_type(__n));
- fill(__position, __position + difference_type(__n), __x);
- _M_finish += difference_type(__n);
- }
- else {
- size_type __len = size() + max(size(), __n);
- unsigned int* __q = _M_bit_alloc(__len);
- iterator __i = copy(begin(), __position, iterator(__q, 0));
- fill_n(__i, __n, __x);
- _M_finish = copy(__position, end(), __i + difference_type(__n));
- _M_deallocate();
- _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
- _M_start = iterator(__q, 0);
+ void flip() {
+ for (unsigned int* __p = _M_start._M_p; __p != _M_end_of_storage; ++__p)
+ *__p = ~*__p;
}
- }
-
- void insert(iterator __position, size_type __n, bool __x) {
- _M_fill_insert(__position, __n, __x);
- }
-
- void pop_back() { --_M_finish; }
- iterator erase(iterator __position) {
- if (__position + 1 != end())
- copy(__position + 1, end(), __position);
- --_M_finish;
- return __position;
- }
- iterator erase(iterator __first, iterator __last) {
- _M_finish = copy(__last, end(), __first);
- return __first;
- }
- void resize(size_type __new_size, bool __x = bool()) {
- if (__new_size < size())
- erase(begin() + difference_type(__new_size), end());
- else
- insert(end(), __new_size - size(), __x);
- }
- void flip() {
- for (unsigned int* __p = _M_start._M_p; __p != _M_end_of_storage; ++__p)
- *__p = ~*__p;
- }
-
- void clear() { erase(begin(), end()); }
-};
-
-#ifdef __SGI_STL_VECBOOL_TEMPLATE
+
+ void clear() { erase(begin(), end()); }
+ };
// This typedef is non-standard. It is provided for backward compatibility.
typedef vector<bool, alloc> bit_vector;
-#else /* __SGI_STL_VECBOOL_TEMPLATE */
-
-inline void swap(bit_vector& __x, bit_vector& __y) {
- __x.swap(__y);
-}
-
-inline bool
-operator==(const bit_vector& __x, const bit_vector& __y)
-{
- return (__x.size() == __y.size() &&
- equal(__x.begin(), __x.end(), __y.begin()));
-}
-
-inline bool
-operator!=(const bit_vector& __x, const bit_vector& __y)
-{
- return !(__x == __y);
-}
-
-inline bool
-operator<(const bit_vector& __x, const bit_vector& __y)
-{
- return lexicographical_compare(__x.begin(), __x.end(),
- __y.begin(), __y.end());
-}
-
-inline bool operator>(const bit_vector& __x, const bit_vector& __y)
-{
- return __y < __x;
-}
-
-inline bool operator<=(const bit_vector& __x, const bit_vector& __y)
-{
- return !(__y < __x);
-}
-
-inline bool operator>=(const bit_vector& __x, const bit_vector& __y)
-{
- return !(__x < __y);
-}
-
-#endif /* __SGI_STL_VECBOOL_TEMPLATE */
-
-#undef __SGI_STL_VECBOOL_TEMPLATE
-#undef __BVECTOR
-#undef __VECTOR
-#undef __BVECTOR_BASE
-#undef __BVECTOR_TMPL_LIST
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_BVECTOR_H */
#include <bits/std_cstddef.h>
-__STL_BEGIN_NAMESPACE
+namespace std
+{
template <class _Key> struct hash { };
return size_t(__h);
}
-__STL_TEMPLATE_NULL struct hash<char*>
+template<> struct hash<char*>
{
size_t operator()(const char* __s) const { return __stl_hash_string(__s); }
};
-__STL_TEMPLATE_NULL struct hash<const char*>
+template<> struct hash<const char*>
{
size_t operator()(const char* __s) const { return __stl_hash_string(__s); }
};
-__STL_TEMPLATE_NULL struct hash<char> {
+template<> struct hash<char> {
size_t operator()(char __x) const { return __x; }
};
-__STL_TEMPLATE_NULL struct hash<unsigned char> {
+template<> struct hash<unsigned char> {
size_t operator()(unsigned char __x) const { return __x; }
};
-__STL_TEMPLATE_NULL struct hash<signed char> {
+template<> struct hash<signed char> {
size_t operator()(unsigned char __x) const { return __x; }
};
-__STL_TEMPLATE_NULL struct hash<short> {
+template<> struct hash<short> {
size_t operator()(short __x) const { return __x; }
};
-__STL_TEMPLATE_NULL struct hash<unsigned short> {
+template<> struct hash<unsigned short> {
size_t operator()(unsigned short __x) const { return __x; }
};
-__STL_TEMPLATE_NULL struct hash<int> {
+template<> struct hash<int> {
size_t operator()(int __x) const { return __x; }
};
-__STL_TEMPLATE_NULL struct hash<unsigned int> {
+template<> struct hash<unsigned int> {
size_t operator()(unsigned int __x) const { return __x; }
};
-__STL_TEMPLATE_NULL struct hash<long> {
+template<> struct hash<long> {
size_t operator()(long __x) const { return __x; }
};
-__STL_TEMPLATE_NULL struct hash<unsigned long> {
+template<> struct hash<unsigned long> {
size_t operator()(unsigned long __x) const { return __x; }
};
-__STL_END_NAMESPACE
+} // namespace std
#endif /* _CPP_BITS_STL_HASH_FUN_H */
#include <bits/stl_vector.h>
#include <ext/stl_hash_fun.h>
-__STL_BEGIN_NAMESPACE
+namespace std
+{
template <class _Val>
struct _Hashtable_node
: _M_cur(__n), _M_ht(__tab) {}
_Hashtable_iterator() {}
reference operator*() const { return _M_cur->_M_val; }
-#ifndef __SGI_STL_NO_ARROW_OPERATOR
pointer operator->() const { return &(operator*()); }
-#endif /* __SGI_STL_NO_ARROW_OPERATOR */
iterator& operator++();
iterator operator++(int);
bool operator==(const iterator& __it) const
_Hashtable_const_iterator(const iterator& __it)
: _M_cur(__it._M_cur), _M_ht(__it._M_ht) {}
reference operator*() const { return _M_cur->_M_val; }
-#ifndef __SGI_STL_NO_ARROW_OPERATOR
pointer operator->() const { return &(operator*()); }
-#endif /* __SGI_STL_NO_ARROW_OPERATOR */
const_iterator& operator++();
const_iterator operator++(int);
bool operator==(const const_iterator& __it) const
private:
typedef _Hashtable_node<_Val> _Node;
-#ifdef __STL_USE_STD_ALLOCATORS
public:
typedef typename _Alloc_traits<_Val,_Alloc>::allocator_type allocator_type;
allocator_type get_allocator() const { return _M_node_allocator; }
typename _Alloc_traits<_Node, _Alloc>::allocator_type _M_node_allocator;
_Node* _M_get_node() { return _M_node_allocator.allocate(1); }
void _M_put_node(_Node* __p) { _M_node_allocator.deallocate(__p, 1); }
-# define __HASH_ALLOC_INIT(__a) _M_node_allocator(__a),
-#else /* __STL_USE_STD_ALLOCATORS */
-public:
- typedef _Alloc allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-private:
- typedef simple_alloc<_Node, _Alloc> _M_node_allocator_type;
- _Node* _M_get_node() { return _M_node_allocator_type::allocate(1); }
- void _M_put_node(_Node* __p) { _M_node_allocator_type::deallocate(__p, 1); }
-# define __HASH_ALLOC_INIT(__a)
-#endif /* __STL_USE_STD_ALLOCATORS */
private:
hasher _M_hash;
const _EqualKey& __eql,
const _ExtractKey& __ext,
const allocator_type& __a = allocator_type())
- : __HASH_ALLOC_INIT(__a)
+ : _M_node_allocator(__a),
_M_hash(__hf),
_M_equals(__eql),
_M_get_key(__ext),
const _HashFcn& __hf,
const _EqualKey& __eql,
const allocator_type& __a = allocator_type())
- : __HASH_ALLOC_INIT(__a)
+ : _M_node_allocator(__a),
_M_hash(__hf),
_M_equals(__eql),
_M_get_key(_ExtractKey()),
}
hashtable(const hashtable& __ht)
- : __HASH_ALLOC_INIT(__ht.get_allocator())
+ : _M_node_allocator(__ht.get_allocator()),
_M_hash(__ht._M_hash),
_M_equals(__ht._M_equals),
_M_get_key(__ht._M_get_key),
_M_copy_from(__ht);
}
-#undef __HASH_ALLOC_INIT
-
hashtable& operator= (const hashtable& __ht)
{
if (&__ht != this) {
void swap(hashtable& __ht)
{
- __STD::swap(_M_hash, __ht._M_hash);
- __STD::swap(_M_equals, __ht._M_equals);
- __STD::swap(_M_get_key, __ht._M_get_key);
+ std::swap(_M_hash, __ht._M_hash);
+ std::swap(_M_equals, __ht._M_equals);
+ std::swap(_M_get_key, __ht._M_get_key);
_M_buckets.swap(__ht._M_buckets);
- __STD::swap(_M_num_elements, __ht._M_num_elements);
+ std::swap(_M_num_elements, __ht._M_num_elements);
}
iterator begin()
const_iterator end() const { return const_iterator(0, this); }
-#ifdef __STL_MEMBER_TEMPLATES
template <class _Vl, class _Ky, class _HF, class _Ex, class _Eq, class _Al>
friend bool operator== (const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&,
const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&);
-#else /* __STL_MEMBER_TEMPLATES */
- friend bool __STD_QUALIFIER
- operator== __STL_NULL_TMPL_ARGS (const hashtable&, const hashtable&);
-#endif /* __STL_MEMBER_TEMPLATES */
-
public:
size_type bucket_count() const { return _M_buckets.size(); }
pair<iterator, bool> insert_unique_noresize(const value_type& __obj);
iterator insert_equal_noresize(const value_type& __obj);
-#ifdef __STL_MEMBER_TEMPLATES
template <class _InputIterator>
void insert_unique(_InputIterator __f, _InputIterator __l)
{
insert_equal_noresize(*__f);
}
-#else /* __STL_MEMBER_TEMPLATES */
- void insert_unique(const value_type* __f, const value_type* __l)
- {
- size_type __n = __l - __f;
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_unique_noresize(*__f);
- }
-
- void insert_equal(const value_type* __f, const value_type* __l)
- {
- size_type __n = __l - __f;
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_equal_noresize(*__f);
- }
-
- void insert_unique(const_iterator __f, const_iterator __l)
- {
- size_type __n = 0;
- distance(__f, __l, __n);
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_unique_noresize(*__f);
- }
-
- void insert_equal(const_iterator __f, const_iterator __l)
- {
- size_type __n = 0;
- distance(__f, __l, __n);
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_equal_noresize(*__f);
- }
-#endif /*__STL_MEMBER_TEMPLATES */
-
reference find_or_insert(const value_type& __obj);
iterator find(const key_type& __key)
return __tmp;
}
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
- class _All>
-inline forward_iterator_tag
-iterator_category(const _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&)
-{
- return forward_iterator_tag();
-}
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
- class _All>
-inline _Val*
-value_type(const _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&)
-{
- return (_Val*) 0;
-}
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
- class _All>
-inline hashtable<_Val,_Key,_HF,_ExK,_EqK,_All>::difference_type*
-distance_type(const _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&)
-{
- return (hashtable<_Val,_Key,_HF,_ExK,_EqK,_All>::difference_type*) 0;
-}
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
- class _All>
-inline forward_iterator_tag
-iterator_category(const _Hashtable_const_iterator<_Val,_Key,_HF,
- _ExK,_EqK,_All>&)
-{
- return forward_iterator_tag();
-}
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
- class _All>
-inline _Val*
-value_type(const _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&)
-{
- return (_Val*) 0;
-}
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
- class _All>
-inline hashtable<_Val,_Key,_HF,_ExK,_EqK,_All>::difference_type*
-distance_type(const _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&)
-{
- return (hashtable<_Val,_Key,_HF,_ExK,_EqK,_All>::difference_type*) 0;
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
bool operator==(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1,
const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht2)
return true;
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
inline bool operator!=(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1,
const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht2) {
__ht1.swap(__ht2);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator, bool>
__STL_UNWIND(clear());
}
-__STL_END_NAMESPACE
+} // namespace std
#endif /* __SGI_STL_INTERNAL_HASHTABLE_H */
# include <mutex.h>
# endif
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#endif
+namespace std
+{
// The _S_eos function is used for those functions that
// convert to/from C-like strings to detect the end of the string.
// behave a little like basic_ostringstream<sequence::value_type> and a
// little like containers.
-template<class _Sequence, size_t _Buf_sz = 100
-# if defined(__sgi) && !defined(__GNUC__)
-# define __TYPEDEF_WORKAROUND
- ,class _V = typename _Sequence::value_type
-# endif
- >
-// The 3rd parameter works around a common compiler bug.
+template<class _Sequence, size_t _Buf_sz = 100>
class sequence_buffer : public output_iterator {
public:
-# ifndef __TYPEDEF_WORKAROUND
- typedef typename _Sequence::value_type value_type;
-# else
- typedef _V value_type;
-# endif
+ typedef typename _Sequence::value_type value_type;
protected:
_Sequence* _M_prefix;
value_type _M_buffer[_Buf_sz];
// First a lot of forward declarations. The standard seems to require
// much stricter "declaration before use" than many of the implementations
// that preceded it.
-template<class _CharT, class _Alloc=__STL_DEFAULT_ALLOCATOR(_CharT)> class rope;
+template<class _CharT, class _Alloc=allocator<_CharT> > class rope;
template<class _CharT, class _Alloc> struct _Rope_RopeConcatenation;
template<class _CharT, class _Alloc> struct _Rope_RopeLeaf;
template<class _CharT, class _Alloc> struct _Rope_RopeFunction;
// the differences between SGI-style allocators and standard-conforming
// allocators.
-#ifdef __STL_USE_STD_ALLOCATORS
-
#define __STATIC_IF_SGI_ALLOC /* not static */
// Base class for ordinary allocators.
: _Base(__size, __a) {}
};
-#else /* !__STL_USE_STD_ALLOCATORS */
-
-#define __STATIC_IF_SGI_ALLOC static
-
-template <class _CharT, class _Alloc>
-class _Rope_rep_base {
-public:
- typedef _Alloc allocator_type;
- static allocator_type get_allocator() { return allocator_type(); }
- _Rope_rep_base(size_t __size, const allocator_type&) : _M_size(__size) {}
- size_t _M_size;
-
-protected:
-
-# define __ROPE_DEFINE_ALLOC(_Tp, __name) \
- typedef simple_alloc<_Tp, _Alloc> __name##Alloc; \
- static _Tp* __name##_allocate(size_t __n) \
- { return __name##Alloc::allocate(__n); } \
- static void __name##_deallocate(_Tp* __p, size_t __n) \
- { __name##Alloc::deallocate(__p, __n); }
- __ROPE_DEFINE_ALLOCS(_Alloc);
-# undef __ROPE_DEFINE_ALLOC
-};
-
-#endif /* __STL_USE_STD_ALLOCATORS */
-
template<class _CharT, class _Alloc>
struct _Rope_RopeRep : public _Rope_rep_base<_CharT,_Alloc>
# ifdef __GC
void _M_incr () {}
# endif
-# ifdef __STL_USE_STD_ALLOCATORS
static void _S_free_string(__GC_CONST _CharT*, size_t __len,
allocator_type __a);
# define __STL_FREE_STRING(__s, __l, __a) _S_free_string(__s, __l, __a);
-# else
- static void _S_free_string(__GC_CONST _CharT*, size_t __len);
-# define __STL_FREE_STRING(__s, __l, __a) _S_free_string(__s, __l);
-# endif
// Deallocate data section of a leaf.
// This shouldn't be a member function.
// But its hard to do anything else at the
}
};
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
- template<class _CharT, class __Alloc>
- inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a,
- _Rope_char_ref_proxy <_CharT, __Alloc > __b) {
- _CharT __tmp = __a;
- __a = __b;
- __b = __tmp;
- }
-#else
-// There is no really acceptable way to handle this. The default
-// definition of swap doesn't work for proxy references.
-// It can't really be made to work, even with ugly hacks, since
-// the only unusual operation it uses is the copy constructor, which
-// is needed for other purposes. We provide a macro for
-// full specializations, and instantiate the most common case.
-# define _ROPE_SWAP_SPECIALIZATION(_CharT, __Alloc) \
- inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a, \
- _Rope_char_ref_proxy <_CharT, __Alloc > __b) { \
- _CharT __tmp = __a; \
- __a = __b; \
- __b = __tmp; \
- }
-
-_ROPE_SWAP_SPECIALIZATION(char,__STL_DEFAULT_ALLOCATOR(char))
-
-#endif /* !__STL_FUNCTION_TMPL_PARTIAL_ORDER */
+template<class _CharT, class __Alloc>
+inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a,
+ _Rope_char_ref_proxy <_CharT, __Alloc > __b) {
+ _CharT __tmp = __a;
+ __a = __b;
+ __b = __tmp;
+}
template<class _CharT, class _Alloc>
class _Rope_char_ptr_proxy {
_M_root = __x._M_root;
return *this;
}
-#ifdef __STL_MEMBER_TEMPLATES
template<class _CharT2, class _Alloc2>
friend bool operator== (const _Rope_char_ptr_proxy<_CharT2,_Alloc2>& __x,
const _Rope_char_ptr_proxy<_CharT2,_Alloc2>& __y);
-#else
- friend bool operator== __STL_NULL_TMPL_ARGS
- (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x,
- const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y);
-#endif
_Rope_char_ref_proxy<_CharT,_Alloc> operator*() const {
return _Rope_char_ref_proxy<_CharT,_Alloc>(_M_root, _M_pos);
}
// Iterators are assumed to be thread private. Ropes can
// be shared.
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1375
-#endif
-
template<class _CharT, class _Alloc>
class _Rope_iterator_base
: public random_access_iterator<_CharT, ptrdiff_t> {
class _Rope_const_iterator : public _Rope_iterator_base<_CharT,_Alloc> {
friend class rope<_CharT,_Alloc>;
protected:
-# ifdef __STL_HAS_NAMESPACES
typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
// The one from the base class may not be directly visible.
-# endif
_Rope_const_iterator(const _RopeRep* __root, size_t __pos):
_Rope_iterator_base<_CharT,_Alloc>(
const_cast<_RopeRep*>(__root), __pos)
_M_decr(1);
return _Rope_const_iterator<_CharT,_Alloc>(_M_root, __old_pos);
}
-#if defined(__STL_MEMBER_TEMPLATES) && defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER)
template<class _CharT2, class _Alloc2>
friend _Rope_const_iterator<_CharT2,_Alloc2> operator-
(const _Rope_const_iterator<_CharT2,_Alloc2>& __x,
friend _Rope_const_iterator<_CharT2,_Alloc2> operator+
(ptrdiff_t __n,
const _Rope_const_iterator<_CharT2,_Alloc2>& __x);
-#else
- friend _Rope_const_iterator<_CharT,_Alloc> operator- __STL_NULL_TMPL_ARGS
- (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- ptrdiff_t __n);
- friend _Rope_const_iterator<_CharT,_Alloc> operator+ __STL_NULL_TMPL_ARGS
- (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- ptrdiff_t __n);
- friend _Rope_const_iterator<_CharT,_Alloc> operator+ __STL_NULL_TMPL_ARGS
- (ptrdiff_t __n,
- const _Rope_const_iterator<_CharT,_Alloc>& __x);
-#endif
-
reference operator[](size_t __n) {
return rope<_CharT,_Alloc>::_S_fetch(_M_root, _M_current_pos + __n);
}
-#if defined(__STL_MEMBER_TEMPLATES) && defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER)
template<class _CharT2, class _Alloc2>
friend bool operator==
(const _Rope_const_iterator<_CharT2,_Alloc2>& __x,
friend ptrdiff_t operator-
(const _Rope_const_iterator<_CharT2,_Alloc2>& __x,
const _Rope_const_iterator<_CharT2,_Alloc2>& __y);
-#else
- friend bool operator== __STL_NULL_TMPL_ARGS
- (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y);
- friend bool operator< __STL_NULL_TMPL_ARGS
- (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y);
- friend ptrdiff_t operator- __STL_NULL_TMPL_ARGS
- (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y);
-#endif
};
template<class _CharT, class _Alloc>
_M_root_rope, _M_current_pos + __n);
}
-#if defined(__STL_MEMBER_TEMPLATES) && defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER)
template<class _CharT2, class _Alloc2>
friend bool operator==
(const _Rope_iterator<_CharT2,_Alloc2>& __x,
friend _Rope_iterator<_CharT2,_Alloc2> operator+
(ptrdiff_t __n,
const _Rope_iterator<_CharT2,_Alloc2>& __x);
-#else
- friend bool operator== __STL_NULL_TMPL_ARGS
- (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y);
- friend bool operator< __STL_NULL_TMPL_ARGS
- (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y);
- friend ptrdiff_t operator- __STL_NULL_TMPL_ARGS
- (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y);
- friend _Rope_iterator<_CharT,_Alloc> operator- __STL_NULL_TMPL_ARGS
- (const _Rope_iterator<_CharT,_Alloc>& __x,
- ptrdiff_t __n);
- friend _Rope_iterator<_CharT,_Alloc> operator+ __STL_NULL_TMPL_ARGS
- (const _Rope_iterator<_CharT,_Alloc>& __x,
- ptrdiff_t __n);
- friend _Rope_iterator<_CharT,_Alloc> operator+ __STL_NULL_TMPL_ARGS
- (ptrdiff_t __n,
- const _Rope_iterator<_CharT,_Alloc>& __x);
-#endif
};
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1375
-#endif
-
// The rope base class encapsulates
// the differences between SGI-style allocators and standard-conforming
// allocators.
-#ifdef __STL_USE_STD_ALLOCATORS
-
// Base class for ordinary allocators.
template <class _CharT, class _Allocator, bool _IsStatic>
class _Rope_alloc_base {
_Rope_base(const allocator_type& __a) : _Base(__a) {}
};
-#else /* !__STL_USE_STD_ALLOCATORS */
-
-template <class _CharT, class _Alloc>
-class _Rope_base {
-public:
- typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
- typedef _Alloc allocator_type;
- static allocator_type get_allocator() { return allocator_type(); }
- _Rope_base(_RopeRep * __t, const allocator_type&) : _M_tree_ptr(__t) {}
- _Rope_base(const allocator_type&) {}
-
-protected:
- // The only data member of a rope:
- _RopeRep* _M_tree_ptr;
-
-# define __ROPE_DEFINE_ALLOC(_Tp, __name) \
- typedef simple_alloc<_Tp, _Alloc> __name##Alloc; \
- static _Tp* __name##_allocate(size_t __n) \
- { return __name##Alloc::allocate(__n); } \
- static void __name##_deallocate(_Tp *__p, size_t __n) \
- { __name##Alloc::deallocate(__p, __n); }
- __ROPE_DEFINE_ALLOCS(_Alloc)
-# undef __ROPE_DEFINE_ALLOC
-};
-
-#endif /* __STL_USE_STD_ALLOCATORS */
-
template <class _CharT, class _Alloc>
class rope : public _Rope_base<_CharT,_Alloc> {
protected:
typedef _Rope_base<_CharT,_Alloc> _Base;
typedef typename _Base::allocator_type allocator_type;
-# ifdef __STL_USE_NAMESPACES
- using _Base::_M_tree_ptr;
-# endif
+ using _Base::_M_tree_ptr;
typedef __GC_CONST _CharT* _Cstrptr;
static _CharT _S_empty_c_str[1];
static _RopeLeaf* _S_new_RopeLeaf(__GC_CONST _CharT *__s,
size_t __size, allocator_type __a)
{
-# ifdef __STL_USE_STD_ALLOCATORS
- _RopeLeaf* __space = _LAllocator(__a).allocate(1);
-# else
- _RopeLeaf* __space = _L_allocate(1);
-# endif
+ _RopeLeaf* __space = _LAllocator(__a).allocate(1);
return new(__space) _RopeLeaf(__s, __size, __a);
}
_RopeRep* __left, _RopeRep* __right,
allocator_type __a)
{
-# ifdef __STL_USE_STD_ALLOCATORS
- _RopeConcatenation* __space = _CAllocator(__a).allocate(1);
-# else
- _RopeConcatenation* __space = _C_allocate(1);
-# endif
+ _RopeConcatenation* __space = _CAllocator(__a).allocate(1);
return new(__space) _RopeConcatenation(__left, __right, __a);
}
static _RopeFunction* _S_new_RopeFunction(char_producer<_CharT>* __f,
size_t __size, bool __d, allocator_type __a)
{
-# ifdef __STL_USE_STD_ALLOCATORS
- _RopeFunction* __space = _FAllocator(__a).allocate(1);
-# else
- _RopeFunction* __space = _F_allocate(1);
-# endif
+ _RopeFunction* __space = _FAllocator(__a).allocate(1);
return new(__space) _RopeFunction(__f, __size, __d, __a);
}
_Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s,
size_t __l, allocator_type __a)
{
-# ifdef __STL_USE_STD_ALLOCATORS
- _RopeSubstring* __space = _SAllocator(__a).allocate(1);
-# else
- _RopeSubstring* __space = _S_allocate(1);
-# endif
+ _RopeSubstring* __space = _SAllocator(__a).allocate(1);
return new(__space) _RopeSubstring(__b, __s, __l, __a);
}
-# ifdef __STL_USE_STD_ALLOCATORS
static
_RopeLeaf* _S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s,
size_t __size, allocator_type __a)
# define __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __size, __a) \
_S_RopeLeaf_from_unowned_char_ptr(__s, __size, __a)
-# else
- static
- _RopeLeaf* _S_RopeLeaf_from_unowned_char_ptr2(const _CharT* __s,
- size_t __size)
-# define __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __size, __a) \
- _S_RopeLeaf_from_unowned_char_ptr2(__s, __size)
-# endif
{
if (0 == __size) return 0;
-# ifdef __STL_USE_STD_ALLOCATORS
- _CharT* __buf = __a.allocate(_S_rounded_up_size(__size));
-# else
- _CharT* __buf = _Data_allocate(_S_rounded_up_size(__size));
- allocator_type __a = allocator_type();
-# endif
+ _CharT* __buf = __a.allocate(_S_rounded_up_size(__size));
uninitialized_copy_n(__s, __size, __buf);
_S_cond_store_eos(__buf[__size]);
rope& operator=(const rope& __x)
{
_RopeRep* __old = _M_tree_ptr;
-# ifdef __STL_USE_STD_ALLOCATORS
- __stl_assert(get_allocator() == __x.get_allocator());
-# endif
+ __stl_assert(get_allocator() == __x.get_allocator());
_M_tree_ptr = __x._M_tree_ptr;
_S_ref(_M_tree_ptr);
_S_unref(__old);
// but it's harder to make guarantees.
}
-# ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
typedef reverse_iterator<const_iterator> const_reverse_iterator;
-# else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
- typedef reverse_iterator<const_iterator, value_type, const_reference,
- difference_type> const_reverse_iterator;
-# endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
const_reverse_iterator rbegin() const {
return const_reverse_iterator(end());
return const_reverse_iterator(begin());
}
-#if defined(__STL_MEMBER_TEMPLATES) && defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER)
template<class _CharT2, class _Alloc2>
friend rope<_CharT2,_Alloc2>
operator+ (const rope<_CharT2,_Alloc2>& __left,
template<class _CharT2, class _Alloc2>
friend rope<_CharT2,_Alloc2>
operator+ (const rope<_CharT2,_Alloc2>& __left, _CharT2 __right);
-#else
- friend rope<_CharT,_Alloc> __STD_QUALIFIER
- operator+ __STL_NULL_TMPL_ARGS (const rope<_CharT,_Alloc>& __left,
- const rope<_CharT,_Alloc>& __right);
-
- friend rope<_CharT,_Alloc> __STD_QUALIFIER
- operator+ __STL_NULL_TMPL_ARGS (const rope<_CharT,_Alloc>& __left,
- const _CharT* __right);
-
- friend rope<_CharT,_Alloc> __STD_QUALIFIER
- operator+ __STL_NULL_TMPL_ARGS (const rope<_CharT,_Alloc>& __left,
- _CharT __right);
-#endif
// The symmetric cases are intentionally omitted, since they're presumed
// to be less common, and we don't handle them as well.
rope& append(const_iterator __s, const_iterator __e) {
__stl_assert(__s._M_root == __e._M_root);
-# ifdef __STL_USE_STD_ALLOCATORS
- __stl_assert(get_allocator() == __s._M_root->get_allocator());
-# endif
+ __stl_assert(get_allocator() == __s._M_root->get_allocator());
_Self_destruct_ptr __appendee(_S_substring(
__s._M_root, __s._M_current_pos, __e._M_current_pos));
_RopeRep* __result =
rope& append() { return append(_CharT()); } // XXX why?
rope& append(const rope& __y) {
-# ifdef __STL_USE_STD_ALLOCATORS
- __stl_assert(__y.get_allocator() == get_allocator());
-# endif
+ __stl_assert(__y.get_allocator() == get_allocator());
_RopeRep* __result = _S_concat(_M_tree_ptr, __y._M_tree_ptr);
_S_unref(_M_tree_ptr);
_M_tree_ptr = __result;
}
void swap(rope& __b) {
-# ifdef __STL_USE_STD_ALLOCATORS
- __stl_assert(get_allocator() == __b.get_allocator());
-# endif
+ __stl_assert(get_allocator() == __b.get_allocator());
_RopeRep* __tmp = _M_tree_ptr;
_M_tree_ptr = __b._M_tree_ptr;
__b._M_tree_ptr = __tmp;
_S_substring(__old, __pos2, __old->_M_size));
_RopeRep* __result;
-# ifdef __STL_USE_STD_ALLOCATORS
- __stl_assert(__old->get_allocator() == __r->get_allocator());
-# endif
+ __stl_assert(__old->get_allocator() == __r->get_allocator());
if (0 == __r) {
__result = _S_concat(__left, __right);
} else {
void insert(size_t __p, const rope& __r) {
_RopeRep* __result =
replace(_M_tree_ptr, __p, __p, __r._M_tree_ptr);
-# ifdef __STL_USE_STD_ALLOCATORS
- __stl_assert(get_allocator() == __r.get_allocator());
-# endif
+ __stl_assert(get_allocator() == __r.get_allocator());
_S_unref(_M_tree_ptr);
_M_tree_ptr = __result;
}
return(iterator(this, size()));
}
-# ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
typedef reverse_iterator<iterator> reverse_iterator;
-# else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
- typedef reverse_iterator<iterator, value_type, reference,
- difference_type> reverse_iterator;
-# endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
reverse_iterator mutable_rbegin() {
return reverse_iterator(mutable_end());
return (__x._M_current_pos < __y._M_current_pos);
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _CharT, class _Alloc>
inline bool operator!= (const _Rope_const_iterator<_CharT,_Alloc>& __x,
const _Rope_const_iterator<_CharT,_Alloc>& __y) {
return !(__x < __y);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
template <class _CharT, class _Alloc>
inline ptrdiff_t operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x,
const _Rope_const_iterator<_CharT,_Alloc>& __y) {
return (__x._M_current_pos < __y._M_current_pos);
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _CharT, class _Alloc>
inline bool operator!= (const _Rope_iterator<_CharT,_Alloc>& __x,
const _Rope_iterator<_CharT,_Alloc>& __y) {
return !(__x < __y);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
template <class _CharT, class _Alloc>
inline ptrdiff_t operator-(const _Rope_iterator<_CharT,_Alloc>& __x,
const _Rope_iterator<_CharT,_Alloc>& __y) {
operator+ (const rope<_CharT,_Alloc>& __left,
const rope<_CharT,_Alloc>& __right)
{
-# ifdef __STL_USE_STD_ALLOCATORS
- __stl_assert(__left.get_allocator() == __right.get_allocator());
-# endif
+ __stl_assert(__left.get_allocator() == __right.get_allocator());
return rope<_CharT,_Alloc>(
rope<_CharT,_Alloc>::_S_concat(__left._M_tree_ptr, __right._M_tree_ptr));
// Inlining this should make it possible to keep __left and
return (__x._M_pos == __y._M_pos && __x._M_root == __y._M_root);
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _CharT, class _Alloc>
inline bool
operator!= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
return !(__x == __y);
}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-#ifdef __STL_USE_NEW_IOSTREAMS
- template<class _CharT, class _Traits, class _Alloc>
- basic_ostream<_CharT, _Traits>& operator<<
+template<class _CharT, class _Traits, class _Alloc>
+basic_ostream<_CharT, _Traits>& operator<<
(basic_ostream<_CharT, _Traits>& __o,
const rope<_CharT, _Alloc>& __r);
-#else
- template<class _CharT, class _Alloc>
- ostream& operator<< (ostream& __o, const rope<_CharT, _Alloc>& __r);
-#endif
-
+
typedef rope<char> crope;
typedef rope<wchar_t> wrope;
return __c.mutable_reference_at(__i);
}
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
template <class _CharT, class _Alloc>
inline void swap(rope<_CharT,_Alloc>& __x, rope<_CharT,_Alloc>& __y) {
__x.swap(__y);
}
-#else
-
-inline void swap(crope __x, crope __y) { __x.swap(__y); }
-inline void swap(wrope __x, wrope __y) { __x.swap(__y); }
-
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
// Hash functions should probably be revisited later:
-__STL_TEMPLATE_NULL struct hash<crope>
+template<> struct hash<crope>
{
size_t operator()(const crope& __str) const
{
};
-__STL_TEMPLATE_NULL struct hash<wrope>
+template<> struct hash<wrope>
{
size_t operator()(const wrope& __str) const
{
}
};
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#endif
-
-__STL_END_NAMESPACE
+} // namespace std
# include <ext/ropeimpl.h>
operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&,
const complex<long double>&);
#endif //_GLIBCPP_USE_WCHAR_T
-}
-
-
-
-
-
-
-
-
+} // namespace std
} // namespace std
-
-
-
-
-
-
-
-
-
-
-
#include <bits/std_istream.h>
#include <bits/std_ostream.h>
-namespace std {
+namespace std
+{
typedef ostreambuf_iterator<char, char_traits<char> > obuf_iterator;
typedef istreambuf_iterator<char, char_traits<char> > ibuf_iterator;
fill(__normal_iterator<locale::facet**, vector<locale::facet*> >,
__normal_iterator<locale::facet**, vector<locale::facet*> >,
locale::facet* const&);
-}
+} // namespace std
#endif // _GLIBCPP_USE_WCHAR_T
} // namespace std
-
-
-
-
-
#include <bits/std_vector.h>
#include <bits/std_stdexcept.h>
-namespace std {
+namespace std
+{
locale::_Impl::
~_Impl() throw()
{
}
}
}
-}
-
-
-
+} // namespace std
#include <bits/ostream.tcc>
#endif
-namespace std {
+namespace std
+{
//
// streambuf
: runtime_error(__arg) { }
} // namespace std
-
-
-
#include <bits/stl_alloc.h>
#include <bits/std_vector.h>
-namespace std {
+namespace std
+{
template class __malloc_alloc_template<0>;
#include <string.h>
#include <limits.h>
-__STL_BEGIN_NAMESPACE
+namespace std
+{
// strstreambuf constructor, destructor.
return _M_buf.str();
}
-__STL_END_NAMESPACE
+} // namespace std
// Local Variables:
// mode:C++
+// Explicit instantiation file.
+
+// Copyright (C) 2001 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// 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.
+
+//
+// ISO C++ 14882:
+//
+
#include <bits/std_valarray.h>
namespace std
_M_index(__l.size() == 0 ? 0 : __valarray_product(__l))
{ __gslice_to_index(__o, __l, __s, _M_index); }
-}
+} // namespace std
+