diff options
102 files changed, 1046 insertions, 4251 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 65f1d406dd9..dd9ef014697 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,109 @@ +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. diff --git a/libstdc++-v3/include/backward/algo.h b/libstdc++-v3/include/backward/algo.h index b46d3242309..f93a8032393 100644 --- a/libstdc++-v3/include/backward/algo.h +++ b/libstdc++-v3/include/backward/algo.h @@ -32,80 +32,76 @@ #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 */ diff --git a/libstdc++-v3/include/backward/algobase.h b/libstdc++-v3/include/backward/algobase.h index b5c807a882f..88e857ea314 100644 --- a/libstdc++-v3/include/backward/algobase.h +++ b/libstdc++-v3/include/backward/algobase.h @@ -39,30 +39,26 @@ #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 */ diff --git a/libstdc++-v3/include/backward/alloc.h b/libstdc++-v3/include/backward/alloc.h index bdca6435917..a90f41fe5f3 100644 --- a/libstdc++-v3/include/backward/alloc.h +++ b/libstdc++-v3/include/backward/alloc.h @@ -19,25 +19,16 @@ #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 */ diff --git a/libstdc++-v3/include/backward/bvector.h b/libstdc++-v3/include/backward/bvector.h index ed922540485..60a9ed6378f 100644 --- a/libstdc++-v3/include/backward/bvector.h +++ b/libstdc++-v3/include/backward/bvector.h @@ -27,20 +27,11 @@ #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 */ diff --git a/libstdc++-v3/include/backward/deque.h b/libstdc++-v3/include/backward/deque.h index fc47056c5ee..65d85bfef5c 100644 --- a/libstdc++-v3/include/backward/deque.h +++ b/libstdc++-v3/include/backward/deque.h @@ -31,9 +31,7 @@ #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 */ diff --git a/libstdc++-v3/include/backward/function.h b/libstdc++-v3/include/backward/function.h index 3d923201893..d4f4489b446 100644 --- a/libstdc++-v3/include/backward/function.h +++ b/libstdc++-v3/include/backward/function.h @@ -33,68 +33,64 @@ #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 */ diff --git a/libstdc++-v3/include/backward/hash_map.h b/libstdc++-v3/include/backward/hash_map.h index ebf0cb8f84b..29ba8d5d100 100644 --- a/libstdc++-v3/include/backward/hash_map.h +++ b/libstdc++-v3/include/backward/hash_map.h @@ -34,13 +34,10 @@ #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 */ diff --git a/libstdc++-v3/include/backward/hash_set.h b/libstdc++-v3/include/backward/hash_set.h index 140ce6048c6..728d7c0d851 100644 --- a/libstdc++-v3/include/backward/hash_set.h +++ b/libstdc++-v3/include/backward/hash_set.h @@ -34,11 +34,9 @@ #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 */ diff --git a/libstdc++-v3/include/backward/hashtable.h b/libstdc++-v3/include/backward/hashtable.h index bd0f4f47433..9ab61a3819d 100644 --- a/libstdc++-v3/include/backward/hashtable.h +++ b/libstdc++-v3/include/backward/hashtable.h @@ -36,10 +36,8 @@ #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 */ diff --git a/libstdc++-v3/include/backward/heap.h b/libstdc++-v3/include/backward/heap.h index bf8b7a18343..8c73b3d1c26 100644 --- a/libstdc++-v3/include/backward/heap.h +++ b/libstdc++-v3/include/backward/heap.h @@ -29,15 +29,10 @@ #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 */ diff --git a/libstdc++-v3/include/backward/iterator.h b/libstdc++-v3/include/backward/iterator.h index 40185036b3b..e2b6ef58cdd 100644 --- a/libstdc++-v3/include/backward/iterator.h +++ b/libstdc++-v3/include/backward/iterator.h @@ -45,57 +45,51 @@ #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 */ diff --git a/libstdc++-v3/include/backward/list.h b/libstdc++-v3/include/backward/list.h index 9a719ff9594..22b5e7a8c1c 100644 --- a/libstdc++-v3/include/backward/list.h +++ b/libstdc++-v3/include/backward/list.h @@ -31,9 +31,7 @@ #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 */ diff --git a/libstdc++-v3/include/backward/map.h b/libstdc++-v3/include/backward/map.h index cf0fe2bc638..e38a3073713 100644 --- a/libstdc++-v3/include/backward/map.h +++ b/libstdc++-v3/include/backward/map.h @@ -30,9 +30,7 @@ #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 */ diff --git a/libstdc++-v3/include/backward/multimap.h b/libstdc++-v3/include/backward/multimap.h index 157e3331aa9..b6bfec22037 100644 --- a/libstdc++-v3/include/backward/multimap.h +++ b/libstdc++-v3/include/backward/multimap.h @@ -30,9 +30,7 @@ #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 */ diff --git a/libstdc++-v3/include/backward/multiset.h b/libstdc++-v3/include/backward/multiset.h index 270a5da8ca3..f5f53abf4fa 100644 --- a/libstdc++-v3/include/backward/multiset.h +++ b/libstdc++-v3/include/backward/multiset.h @@ -30,9 +30,7 @@ #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 */ diff --git a/libstdc++-v3/include/backward/pair.h b/libstdc++-v3/include/backward/pair.h index 97b36d5a1d4..c8f2fa3dea2 100644 --- a/libstdc++-v3/include/backward/pair.h +++ b/libstdc++-v3/include/backward/pair.h @@ -32,12 +32,8 @@ #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 */ diff --git a/libstdc++-v3/include/backward/rope.h b/libstdc++-v3/include/backward/rope.h index 7d32f87497e..4efa4eefc52 100644 --- a/libstdc++-v3/include/backward/rope.h +++ b/libstdc++-v3/include/backward/rope.h @@ -17,15 +17,11 @@ #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 */ diff --git a/libstdc++-v3/include/backward/set.h b/libstdc++-v3/include/backward/set.h index e05890e046e..4fad9154ba0 100644 --- a/libstdc++-v3/include/backward/set.h +++ b/libstdc++-v3/include/backward/set.h @@ -30,9 +30,7 @@ #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 */ diff --git a/libstdc++-v3/include/backward/slist.h b/libstdc++-v3/include/backward/slist.h index 8c63282d1ca..d979829328d 100644 --- a/libstdc++-v3/include/backward/slist.h +++ b/libstdc++-v3/include/backward/slist.h @@ -17,9 +17,7 @@ #include <ext/slist> -#ifdef __STL_USE_NAMESPACES -using __STD::slist; -#endif /* __STL_USE_NAMESPACES */ +using std::slist; #endif /* _CPP_BACKWARD_SLIST_H */ diff --git a/libstdc++-v3/include/backward/stack.h b/libstdc++-v3/include/backward/stack.h index 4140f409970..85387e1b0c2 100644 --- a/libstdc++-v3/include/backward/stack.h +++ b/libstdc++-v3/include/backward/stack.h @@ -33,11 +33,9 @@ #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 */ diff --git a/libstdc++-v3/include/backward/strstream b/libstdc++-v3/include/backward/strstream index 0a6a129f4ef..51db6b5c91f 100644 --- a/libstdc++-v3/include/backward/strstream +++ b/libstdc++-v3/include/backward/strstream @@ -29,7 +29,8 @@ #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. @@ -150,7 +151,7 @@ private: strstreambuf _M_buf; }; -__STL_END_NAMESPACE +} // namespace std #endif /* __SGI_STL_STRSTREAM */ diff --git a/libstdc++-v3/include/backward/tempbuf.h b/libstdc++-v3/include/backward/tempbuf.h index 82e5c8e811b..b8d36d79373 100644 --- a/libstdc++-v3/include/backward/tempbuf.h +++ b/libstdc++-v3/include/backward/tempbuf.h @@ -47,13 +47,9 @@ #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 */ diff --git a/libstdc++-v3/include/backward/tree.h b/libstdc++-v3/include/backward/tree.h index 64e89ad36fe..bca51de6f51 100644 --- a/libstdc++-v3/include/backward/tree.h +++ b/libstdc++-v3/include/backward/tree.h @@ -35,9 +35,7 @@ #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 */ diff --git a/libstdc++-v3/include/backward/vector.h b/libstdc++-v3/include/backward/vector.h index 8a7e8f94040..23aa5370495 100644 --- a/libstdc++-v3/include/backward/vector.h +++ b/libstdc++-v3/include/backward/vector.h @@ -31,9 +31,7 @@ #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 */ diff --git a/libstdc++-v3/include/bits/basic_ios.h b/libstdc++-v3/include/bits/basic_ios.h index 9019e2bf29a..efaf2c7e0ac 100644 --- a/libstdc++-v3/include/bits/basic_ios.h +++ b/libstdc++-v3/include/bits/basic_ios.h @@ -214,9 +214,3 @@ namespace std { #endif /* _CPP_BITS_BASICIOS_H */ - - - - - - diff --git a/libstdc++-v3/include/bits/basic_ios.tcc b/libstdc++-v3/include/bits/basic_ios.tcc index d4178c286a9..d561b3bcbe0 100644 --- a/libstdc++-v3/include/bits/basic_ios.tcc +++ b/libstdc++-v3/include/bits/basic_ios.tcc @@ -135,6 +135,3 @@ namespace std { #endif /* _CPP_BITS_BASICIOS_TCC */ - - - diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index af831146382..4067396311d 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -38,7 +38,8 @@ #include <bits/atomicity.h> -namespace std { +namespace std +{ // Documentation? What's that? // Nathan Myers <ncm@cantrip.org>. diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index a6401ebe2d6..63c9762b9a3 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -55,7 +55,6 @@ // 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 @@ -64,18 +63,13 @@ # 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 @@ -92,26 +86,34 @@ # 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 @@ -119,30 +121,14 @@ # 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) \ @@ -152,6 +138,7 @@ # define __stl_assert(expr) #endif + #if defined(__STL_WIN32THREADS) || defined(__STL_SGI_THREADS) \ || defined(__STL_PTHREADS) || defined(__STL_UITHREADS) # define __STL_THREADS @@ -160,12 +147,6 @@ # 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. diff --git a/libstdc++-v3/include/bits/concept_checks.h b/libstdc++-v3/include/bits/concept_checks.h index 4a0e2d55703..aa77d9af063 100644 --- a/libstdc++-v3/include/bits/concept_checks.h +++ b/libstdc++-v3/include/bits/concept_checks.h @@ -490,34 +490,35 @@ struct _STL_ERROR { /* 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; }; @@ -797,8 +798,7 @@ _Allocator_requirement_violation(_Alloc __a) { __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); } }; diff --git a/libstdc++-v3/include/bits/fpos.h b/libstdc++-v3/include/bits/fpos.h index f8b3cb6f294..9dc8decd77c 100644 --- a/libstdc++-v3/include/bits/fpos.h +++ b/libstdc++-v3/include/bits/fpos.h @@ -41,7 +41,8 @@ // not have included the std_ios file. #include <bits/c++io.h> -namespace std { +namespace std +{ // 27.4.1 Types diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc index 07e1f61cc9f..3969dcd566e 100644 --- a/libstdc++-v3/include/bits/fstream.tcc +++ b/libstdc++-v3/include/bits/fstream.tcc @@ -580,11 +580,3 @@ namespace std #endif // _CPP_BITS_FSTREAM_TCC - - - - - - - - diff --git a/libstdc++-v3/include/bits/functexcept.h b/libstdc++-v3/include/bits/functexcept.h index a808a16e5ac..eac2c95b432 100644 --- a/libstdc++-v3/include/bits/functexcept.h +++ b/libstdc++-v3/include/bits/functexcept.h @@ -82,3 +82,4 @@ namespace std void __throw_ios_failure(const char* __s); } // namespace std + diff --git a/libstdc++-v3/include/bits/ios_base.h b/libstdc++-v3/include/bits/ios_base.h index 801011517cf..ce68bf188ed 100644 --- a/libstdc++-v3/include/bits/ios_base.h +++ b/libstdc++-v3/include/bits/ios_base.h @@ -36,7 +36,8 @@ #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 @@ -568,11 +569,3 @@ namespace std { #endif /* _CPP_BITS_IOSBASE_H */ - - - - - - - - diff --git a/libstdc++-v3/include/bits/istream.tcc b/libstdc++-v3/include/bits/istream.tcc index f48c198485e..121dee279b5 100644 --- a/libstdc++-v3/include/bits/istream.tcc +++ b/libstdc++-v3/include/bits/istream.tcc @@ -1207,16 +1207,3 @@ namespace std { // mode:C++ // End: - - - - - - - - - - - - - diff --git a/libstdc++-v3/include/bits/mask_array.h b/libstdc++-v3/include/bits/mask_array.h index 2693564a0af..b2399ba1fa7 100644 --- a/libstdc++-v3/include/bits/mask_array.h +++ b/libstdc++-v3/include/bits/mask_array.h @@ -1,6 +1,6 @@ // 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 diff --git a/libstdc++-v3/include/bits/ostream.tcc b/libstdc++-v3/include/bits/ostream.tcc index 98de13a6565..50f3b9b38e1 100644 --- a/libstdc++-v3/include/bits/ostream.tcc +++ b/libstdc++-v3/include/bits/ostream.tcc @@ -672,12 +672,3 @@ namespace std { // mode:C++ // End: - - - - - - - - - diff --git a/libstdc++-v3/include/bits/pthread_allocimpl.h b/libstdc++-v3/include/bits/pthread_allocimpl.h index bc11f9ced11..195905a3ace 100644 --- a/libstdc++-v3/include/bits/pthread_allocimpl.h +++ b/libstdc++-v3/include/bits/pthread_allocimpl.h @@ -34,11 +34,10 @@ # define __RESTRICT #endif -#ifndef __STL_NO_BAD_ALLOC -# include <new> -#endif +#include <new> -__STL_BEGIN_NAMESPACE +namespace std +{ #define __STL_DATA_ALIGNMENT 8 @@ -213,7 +212,7 @@ _Pthread_alloc_template<_Max_size>::_S_get_per_thread_state() _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; } @@ -221,7 +220,7 @@ _Pthread_alloc_template<_Max_size>::_S_get_per_thread_state() __ret_code = pthread_setspecific(_S_key, __result); if (__ret_code) { if (__ret_code == ENOMEM) { - __THROW_BAD_ALLOC; + std::__throw_bad_alloc(); } else { // EINVAL abort(); @@ -377,7 +376,6 @@ template <size_t _Max_size> size_t _Pthread_alloc_template<_Max_size> ::_S_heap_size = 0; -#ifdef __STL_USE_STD_ALLOCATORS template <class _Tp> class pthread_allocator { @@ -484,9 +482,7 @@ struct _Alloc_traits<_Tp, pthread_allocator<_Atype> > }; -#endif /* __STL_USE_STD_ALLOCATORS */ - -__STL_END_NAMESPACE +} // namespace std #endif /* _CPP_BITS_PTHREAD_ALLOCIMPL_H */ diff --git a/libstdc++-v3/include/bits/sbuf_iter.h b/libstdc++-v3/include/bits/sbuf_iter.h index 351c8c9bce2..2b2a1915eee 100644 --- a/libstdc++-v3/include/bits/sbuf_iter.h +++ b/libstdc++-v3/include/bits/sbuf_iter.h @@ -250,17 +250,3 @@ namespace std #endif /* _CPP_BITS_SBUF_ITER_H */ - - - - - - - - - - - - - - diff --git a/libstdc++-v3/include/bits/slice.h b/libstdc++-v3/include/bits/slice.h index 113ff9b85c7..5efb6e8cf4c 100644 --- a/libstdc++-v3/include/bits/slice.h +++ b/libstdc++-v3/include/bits/slice.h @@ -1,6 +1,6 @@ // 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 @@ -34,7 +34,8 @@ #pragma GCC system_header -namespace std { +namespace std +{ class slice { diff --git a/libstdc++-v3/include/bits/slice_array.h b/libstdc++-v3/include/bits/slice_array.h index d016a062197..a38da2a837c 100644 --- a/libstdc++-v3/include/bits/slice_array.h +++ b/libstdc++-v3/include/bits/slice_array.h @@ -1,6 +1,6 @@ // 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 @@ -34,7 +34,8 @@ #pragma GCC system_header -namespace std { +namespace std +{ template<typename _Tp> class slice_array diff --git a/libstdc++-v3/include/bits/sstream.tcc b/libstdc++-v3/include/bits/sstream.tcc index 5c737b4fa2e..b2c5703f8b4 100644 --- a/libstdc++-v3/include/bits/sstream.tcc +++ b/libstdc++-v3/include/bits/sstream.tcc @@ -1,6 +1,6 @@ // 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 @@ -36,7 +36,8 @@ #include <bits/std_sstream.h> -namespace std { +namespace std +{ template <class _CharT, class _Traits, class _Alloc> basic_stringbuf<_CharT, _Traits, _Alloc>::int_type @@ -210,11 +211,3 @@ namespace std { #endif /* _CPP_BITS_SSTREAM_TCC */ - - - - - - - - diff --git a/libstdc++-v3/include/bits/std_bitset.h b/libstdc++-v3/include/bits/std_bitset.h index 0614e01995e..9ea657fc9d1 100644 --- a/libstdc++-v3/include/bits/std_bitset.h +++ b/libstdc++-v3/include/bits/std_bitset.h @@ -38,21 +38,14 @@ #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> @@ -315,7 +308,7 @@ _Base_bitset<_Nw>::_M_do_find_next(size_t __prev, size_t __not_found) const // 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; @@ -381,7 +374,7 @@ template <size_t _Extrabits> struct _Sanitize { { __val &= ~((~static_cast<unsigned long>(0)) << _Extrabits); } }; -__STL_TEMPLATE_NULL struct _Sanitize<0> { +template<> struct _Sanitize<0> { static void _M_do_sanitize(unsigned long) {} }; @@ -466,7 +459,6 @@ public: 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) @@ -487,17 +479,6 @@ public: __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) { @@ -619,18 +600,14 @@ public: 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, @@ -638,10 +615,6 @@ public: 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(); } @@ -689,8 +662,6 @@ public: // Definitions of non-inline member functions. // -#ifdef __STL_MEMBER_TEMPLATES - template <size_t _Nb> template<class _CharT, class _Traits, class _Alloc> void bitset<_Nb> @@ -725,40 +696,6 @@ 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 */ - // ------------------------------------------------------------ // @@ -787,8 +724,6 @@ inline bitset<_Nb> operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y) { 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) @@ -802,7 +737,7 @@ 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)) { @@ -840,59 +775,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Nb>& __x) 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 diff --git a/libstdc++-v3/include/bits/std_fstream.h b/libstdc++-v3/include/bits/std_fstream.h index 98740f54d52..4516f1b7f72 100644 --- a/libstdc++-v3/include/bits/std_fstream.h +++ b/libstdc++-v3/include/bits/std_fstream.h @@ -416,8 +416,3 @@ namespace std { #endif /* _CPP_FSTREAM */ - - - - - diff --git a/libstdc++-v3/include/bits/std_iomanip.h b/libstdc++-v3/include/bits/std_iomanip.h index 0134a631584..5e0cb91bdc1 100644 --- a/libstdc++-v3/include/bits/std_iomanip.h +++ b/libstdc++-v3/include/bits/std_iomanip.h @@ -1,6 +1,6 @@ // 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 @@ -40,7 +40,8 @@ #include <bits/std_istream.h> #include <bits/std_functional.h> -namespace std { +namespace std +{ struct _Resetiosflags { ios_base::fmtflags _M_mask; }; @@ -215,7 +216,3 @@ namespace std { #endif /* __IOMANIP */ - - - - diff --git a/libstdc++-v3/include/bits/std_ios.h b/libstdc++-v3/include/bits/std_ios.h index b88f4fc975a..abedfe6abc4 100644 --- a/libstdc++-v3/include/bits/std_ios.h +++ b/libstdc++-v3/include/bits/std_ios.h @@ -47,7 +47,3 @@ #endif /* _CPP_IOS */ - - - - diff --git a/libstdc++-v3/include/bits/std_istream.h b/libstdc++-v3/include/bits/std_istream.h index 4c93f560960..bfaec7033c6 100644 --- a/libstdc++-v3/include/bits/std_istream.h +++ b/libstdc++-v3/include/bits/std_istream.h @@ -1,6 +1,6 @@ // 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 @@ -39,7 +39,8 @@ #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> @@ -300,10 +301,3 @@ namespace std { #endif /* _CPP_ISTREAM */ - - - - - - - diff --git a/libstdc++-v3/include/bits/std_iterator.h b/libstdc++-v3/include/bits/std_iterator.h index 12c3fb43c9c..f4577157279 100644 --- a/libstdc++-v3/include/bits/std_iterator.h +++ b/libstdc++-v3/include/bits/std_iterator.h @@ -40,7 +40,3 @@ // mode:C++ // End: - - - - diff --git a/libstdc++-v3/include/bits/std_memory.h b/libstdc++-v3/include/bits/std_memory.h index 49b08ad7e7b..0f58c08b436 100644 --- a/libstdc++-v3/include/bits/std_memory.h +++ b/libstdc++-v3/include/bits/std_memory.h @@ -25,18 +25,14 @@ #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; @@ -47,23 +43,19 @@ public: 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 @@ -96,10 +88,6 @@ public: // 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) {} @@ -116,11 +104,9 @@ public: { 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 */ diff --git a/libstdc++-v3/include/bits/std_ostream.h b/libstdc++-v3/include/bits/std_ostream.h index d6fcab6df56..6cd64b8d7c7 100644 --- a/libstdc++-v3/include/bits/std_ostream.h +++ b/libstdc++-v3/include/bits/std_ostream.h @@ -38,8 +38,8 @@ #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> diff --git a/libstdc++-v3/include/bits/std_sstream.h b/libstdc++-v3/include/bits/std_sstream.h index bb00ba55506..9a1e75a2118 100644 --- a/libstdc++-v3/include/bits/std_sstream.h +++ b/libstdc++-v3/include/bits/std_sstream.h @@ -39,8 +39,8 @@ #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> { @@ -350,19 +350,5 @@ namespace std { #endif #endif - #endif /* _CPP_SSTREAM */ - - - - - - - - - - - - - diff --git a/libstdc++-v3/include/bits/std_streambuf.h b/libstdc++-v3/include/bits/std_streambuf.h index e1b078436eb..304beeea7b7 100644 --- a/libstdc++-v3/include/bits/std_streambuf.h +++ b/libstdc++-v3/include/bits/std_streambuf.h @@ -42,8 +42,8 @@ #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, @@ -537,13 +537,3 @@ namespace std { #endif /* _CPP_STREAMBUF */ - - - - - - - - - - diff --git a/libstdc++-v3/include/bits/std_string.h b/libstdc++-v3/include/bits/std_string.h index a4b6d9e426d..b781b43a64a 100644 --- a/libstdc++-v3/include/bits/std_string.h +++ b/libstdc++-v3/include/bits/std_string.h @@ -52,15 +52,3 @@ #endif /* _CPP_STRING */ - - - - - - - - - - - - diff --git a/libstdc++-v3/include/bits/std_valarray.h b/libstdc++-v3/include/bits/std_valarray.h index 45bd8fb0f90..99f17e482b6 100644 --- a/libstdc++-v3/include/bits/std_valarray.h +++ b/libstdc++-v3/include/bits/std_valarray.h @@ -1,6 +1,6 @@ // 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 @@ -42,8 +42,8 @@ #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; @@ -82,13 +82,13 @@ namespace std { 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: @@ -254,8 +254,8 @@ namespace std { #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) {} @@ -627,7 +627,8 @@ _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(>>, shift_right) } // std:: -namespace std { +namespace std +{ #define _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(_Op, _Name) \ template<class _Tp> template<class _Dom> \ diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index c432d3d3ebc..090f0d6720e 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -36,12 +36,8 @@ // 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). @@ -113,8 +109,6 @@ inline _InputIter find_if(_InputIter __first, _InputIter __last, return __first; } -#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION - template <class _RandomAccessIter, class _Tp> _RandomAccessIter find(_RandomAccessIter __first, _RandomAccessIter __last, const _Tp& __val, @@ -191,8 +185,6 @@ _RandomAccessIter find_if(_RandomAccessIter __first, _RandomAccessIter __last, } } -#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - template <class _InputIter, class _Tp> inline _InputIter find(_InputIter __first, _InputIter __last, const _Tp& __val) @@ -277,8 +269,6 @@ void count_if(_InputIter __first, _InputIter __last, _Predicate __pred, ++__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) { @@ -307,8 +297,6 @@ count_if(_InputIter __first, _InputIter __last, _Predicate __pred) { } -#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ - // search. template <class _ForwardIter1, class _ForwardIter2> @@ -3098,8 +3086,6 @@ _ForwardIter1 __find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, } // 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, @@ -3152,7 +3138,6 @@ __find_end(_BidirectionalIter1 __first1, _BidirectionalIter1 __last1, return __result; } } -#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ // Dispatching functions for find_end. @@ -3284,11 +3269,7 @@ bool is_sorted(_ForwardIter __first, _ForwardIter __last, 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 */ diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h index 921dbab7f71..c4620c1c6a3 100644 --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -45,18 +45,14 @@ #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 @@ -89,8 +85,6 @@ inline void swap(_Tp& __a, _Tp& __b) { //-------------------------------------------------- // min and max -#if !defined(__BORLANDC__) || __BORLANDC__ >= 0x540 /* C++ Builder 4.0 */ - #undef min #undef max @@ -108,8 +102,6 @@ inline const _Tp& max(const _Tp& __a, const _Tp& __b) { 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; @@ -161,7 +153,6 @@ __copy_trivial(const _Tp* __first, const _Tp* __last, _Tp* __result) { return __result + (__last - __first); } -#if defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER) template <class _InputIter, class _OutputIter> inline _OutputIter __copy_aux2(_InputIter __first, _InputIter __last, @@ -240,91 +231,6 @@ inline _OutputIter copy(_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 @@ -353,7 +259,6 @@ inline _BidirectionalIter __copy_backward(_RandomAccessIter __first, 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 @@ -443,17 +348,6 @@ inline _BI2 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) { __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) @@ -531,8 +425,6 @@ inline void fill(char* __first, char* __last, const char& __c) { 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) { @@ -553,7 +445,6 @@ inline char* fill_n(char* __first, _Size __n, const char& __c) { return __first + __n; } -#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ //-------------------------------------------------- // equal and mismatch @@ -746,7 +637,7 @@ int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1, return __lexicographical_compare_3way(__first1, __last1, __first2, __last2); } -__STL_END_NAMESPACE +} // namespace std #endif /* __SGI_STL_INTERNAL_ALGOBASE_H */ diff --git a/libstdc++-v3/include/bits/stl_alloc.h b/libstdc++-v3/include/bits/stl_alloc.h index c8332167f01..9a0ef07e604 100644 --- a/libstdc++-v3/include/bits/stl_alloc.h +++ b/libstdc++-v3/include/bits/stl_alloc.h @@ -18,19 +18,6 @@ #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 @@ -38,17 +25,7 @@ // 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> @@ -88,23 +65,11 @@ # 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 { @@ -112,10 +77,7 @@ private: 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: @@ -149,10 +111,8 @@ 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* @@ -163,7 +123,7 @@ __malloc_alloc_template<__inst>::_S_oom_malloc(size_t __n) 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); @@ -178,7 +138,7 @@ void* __malloc_alloc_template<__inst>::_S_oom_realloc(void* __p, size_t __n) 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); @@ -278,40 +238,26 @@ typedef malloc_alloc single_client_alloc; // 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); } @@ -409,14 +355,12 @@ inline bool operator==(const __default_alloc_template<__threads, __inst>&, 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 */ @@ -563,11 +507,7 @@ size_t __default_alloc_template<__threads, __inst>::_S_heap_size = 0; 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 @@ -583,8 +523,6 @@ __default_alloc_template<__threads, __inst> ::_S_free_list[ // 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. @@ -726,14 +664,12 @@ inline bool operator==(const __allocator<_Tp, _Alloc>& __a1, 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 @@ -746,14 +682,12 @@ inline bool operator==(const __malloc_alloc_template<inst>&, 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>&, @@ -761,13 +695,11 @@ 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 @@ -801,8 +733,7 @@ template <class _Tp, class _Allocator> 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> @@ -882,16 +813,7 @@ struct _Alloc_traits<_Tp, __allocator<_Tp1, debug_alloc<_Alloc> > > 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 */ diff --git a/libstdc++-v3/include/bits/stl_construct.h b/libstdc++-v3/include/bits/stl_construct.h index c23b77ea993..e423bdd3a77 100644 --- a/libstdc++-v3/include/bits/stl_construct.h +++ b/libstdc++-v3/include/bits/stl_construct.h @@ -33,7 +33,8 @@ #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 @@ -88,9 +89,7 @@ inline void _Destroy(int*, int*) {} 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. @@ -115,7 +114,7 @@ inline void destroy(_ForwardIterator __first, _ForwardIterator __last) { _Destroy(__first, __last); } -__STL_END_NAMESPACE +} // namespace std #endif /* _CPP_BITS_STL_CONSTRUCT_H */ diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h index aea97ec7711..040152d9da1 100644 --- a/libstdc++-v3/include/bits/stl_deque.h +++ b/libstdc++-v3/include/bits/stl_deque.h @@ -67,12 +67,8 @@ * 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. @@ -110,9 +106,7 @@ struct _Deque_iterator { _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) + @@ -202,24 +196,6 @@ operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Ref, _Ptr>& __x) 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 @@ -227,8 +203,6 @@ inline ptrdiff_t* distance_type(const _Deque_iterator<_Tp,_Ref,_Ptr>&) { // 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 { @@ -323,52 +297,6 @@ protected: 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> @@ -423,7 +351,7 @@ _Deque_base<_Tp,_Alloc>::_M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish) _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: @@ -447,23 +375,14 @@ public: // Iterators 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; @@ -476,7 +395,6 @@ protected: 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; } @@ -496,7 +414,6 @@ public: // Basic accessors 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"); @@ -506,7 +423,6 @@ public: // Basic accessors { _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() { @@ -536,8 +452,6 @@ public: // Constructor, destructor. 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, @@ -558,19 +472,6 @@ public: // Constructor, destructor. _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) { @@ -588,10 +489,10 @@ public: // Constructor, destructor. } 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: @@ -615,8 +516,6 @@ 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; @@ -654,8 +553,6 @@ private: // helper functions for assign() erase(copy(__first, __last, begin()), end()); } -#endif /* __STL_MEMBER_TEMPLATES */ - public: // push_* and pop_* void push_back(const value_type& __t) { @@ -739,8 +636,6 @@ public: // Insert 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) { @@ -761,15 +656,6 @@ public: // Insert 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) @@ -803,8 +689,6 @@ protected: // Internal construction/destruction 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); @@ -813,8 +697,6 @@ protected: // Internal construction/destruction 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&); @@ -826,8 +708,6 @@ protected: // Internal push_* and pop_* protected: // Internal insert functions -#ifdef __STL_MEMBER_TEMPLATES - template <class _InputIterator> void insert(iterator __pos, _InputIterator __first, _InputIterator __last, input_iterator_tag); @@ -837,31 +717,15 @@ protected: // Internal insert functions _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) @@ -900,8 +764,6 @@ protected: // Allocation of _M_map and nodes // Non-inline member functions -#ifdef __STL_MEMBER_TEMPLATES - template <class _Tp, class _Alloc> template <class _InputIter> void deque<_Tp, _Alloc> @@ -916,8 +778,6 @@ 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) @@ -943,62 +803,6 @@ void deque<_Tp, _Alloc>::_M_fill_insert(iterator __pos, _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) @@ -1062,8 +866,6 @@ void deque<_Tp,_Alloc>::_M_fill_initialize(const value_type& __value) { __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, @@ -1101,8 +903,6 @@ void deque<_Tp,_Alloc>::_M_range_initialize(_ForwardIterator __first, __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) @@ -1184,8 +984,6 @@ void deque<_Tp,_Alloc>::_M_pop_front_aux() _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, @@ -1222,8 +1020,6 @@ deque<_Tp,_Alloc>::insert(iterator __pos, _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) @@ -1338,8 +1134,6 @@ void deque<_Tp,_Alloc>::_M_insert_aux(iterator __pos, } } -#ifdef __STL_MEMBER_TEMPLATES - template <class _Tp, class _Alloc> template <class _ForwardIterator> void deque<_Tp,_Alloc>::_M_insert_aux(iterator __pos, _ForwardIterator __first, @@ -1398,122 +1192,6 @@ void deque<_Tp,_Alloc>::_M_insert_aux(iterator __pos, } } -#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) { @@ -1606,8 +1284,6 @@ inline bool operator<(const deque<_Tp, _Alloc>& __x, __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) { @@ -1636,14 +1312,7 @@ inline void swap(deque<_Tp,_Alloc>& __x, 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 */ diff --git a/libstdc++-v3/include/bits/stl_function.h b/libstdc++-v3/include/bits/stl_function.h index fcaafac5668..6c26193dd81 100644 --- a/libstdc++-v3/include/bits/stl_function.h +++ b/libstdc++-v3/include/bits/stl_function.h @@ -31,7 +31,8 @@ #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 { @@ -589,8 +590,6 @@ private: _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: @@ -666,7 +665,6 @@ private: 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 @@ -723,7 +721,7 @@ inline const_mem_fun1_ref_t<_Ret,_Tp,_Arg> 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 */ diff --git a/libstdc++-v3/include/bits/stl_heap.h b/libstdc++-v3/include/bits/stl_heap.h index 3e7eaa456e5..a6003c8f43f 100644 --- a/libstdc++-v3/include/bits/stl_heap.h +++ b/libstdc++-v3/include/bits/stl_heap.h @@ -30,11 +30,8 @@ #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. @@ -284,11 +281,7 @@ sort_heap(_RandomAccessIterator __first, 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 */ diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h index ae8b0886653..a062d4dcb01 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -31,8 +31,8 @@ #ifndef __SGI_STL_INTERNAL_ITERATOR_H #define __SGI_STL_INTERNAL_ITERATOR_H -__STL_BEGIN_NAMESPACE - +namespace std +{ template <class _Container> class back_insert_iterator { @@ -57,17 +57,6 @@ public: 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); @@ -96,17 +85,6 @@ public: 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); @@ -138,17 +116,6 @@ public: 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) @@ -179,9 +146,7 @@ public: _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; @@ -202,39 +167,6 @@ public: } }; -#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, @@ -243,8 +175,6 @@ inline bool operator==( 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, @@ -253,10 +183,6 @@ inline bool operator!=( 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, @@ -289,20 +215,16 @@ public: 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; @@ -352,8 +274,6 @@ inline bool operator<(const reverse_iterator<_Iterator>& __x, 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) { @@ -378,8 +298,6 @@ inline bool operator>=(const reverse_iterator<_Iterator>& __x, 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, @@ -394,186 +312,6 @@ operator+(typename reverse_iterator<_Iterator>::difference_type __n, 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>, @@ -630,8 +368,6 @@ operator==(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x, 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, @@ -639,7 +375,6 @@ 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> > @@ -671,279 +406,6 @@ private: 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 @@ -1077,7 +539,7 @@ operator+(__normal_iterator<_Iterator, _Container>::difference_type __n, 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 */ diff --git a/libstdc++-v3/include/bits/stl_iterator_base.h b/libstdc++-v3/include/bits/stl_iterator_base.h index 44a6f8fbfb0..5c5ac2c0f82 100644 --- a/libstdc++-v3/include/bits/stl_iterator_base.h +++ b/libstdc++-v3/include/bits/stl_iterator_base.h @@ -37,7 +37,8 @@ #include <bits/concept_checks.h> -__STL_BEGIN_NAMESPACE +namespace std +{ struct input_iterator_tag {}; struct output_iterator_tag {}; @@ -91,7 +92,6 @@ template <class _Tp, class _Distance> struct random_access_iterator { typedef _Tp& reference; }; -#ifdef __STL_USE_NAMESPACES template <class _Category, class _Tp, class _Distance = ptrdiff_t, class _Pointer = _Tp*, class _Reference = _Tp&> struct iterator { @@ -101,9 +101,6 @@ struct iterator { typedef _Pointer pointer; typedef _Reference reference; }; -#endif /* __STL_USE_NAMESPACES */ - -#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION template <class _Iterator> struct iterator_traits { @@ -178,92 +175,6 @@ value_type(const _Iter& __i) { return __value_type(__i); } #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) @@ -288,8 +199,6 @@ inline void distance(_InputIterator __first, __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) @@ -318,17 +227,11 @@ distance(_InputIterator __first, _InputIterator __last) { 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) { @@ -339,10 +242,6 @@ inline void __advance(_BidirectionalIterator& __i, _Distance __n, 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) { @@ -356,12 +255,11 @@ inline void advance(_InputIterator& __i, _Distance __n) { __advance(__i, __n, iterator_category(__i)); } -__STL_END_NAMESPACE +} // namespace std #endif /* __SGI_STL_INTERNAL_ITERATOR_BASE_H */ - // Local Variables: // mode:C++ // End: diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h index 1967a7a933d..b018317b87b 100644 --- a/libstdc++-v3/include/bits/stl_list.h +++ b/libstdc++-v3/include/bits/stl_list.h @@ -33,12 +33,8 @@ #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; @@ -87,10 +83,7 @@ struct _List_iterator : public _List_iterator_base { _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(); @@ -112,29 +105,6 @@ struct _List_iterator : public _List_iterator_base { } }; -#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 @@ -143,7 +113,6 @@ distance_type(const _List_iterator_base&) // 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> @@ -212,37 +181,6 @@ public: 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 @@ -286,24 +224,13 @@ public: 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) @@ -358,7 +285,7 @@ public: 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); @@ -369,9 +296,8 @@ public: 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) { @@ -389,11 +315,6 @@ public: _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); @@ -432,8 +353,6 @@ public: : _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> @@ -442,18 +361,6 @@ public: : _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()); } @@ -471,8 +378,6 @@ public: 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; @@ -487,8 +392,6 @@ public: 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) { @@ -526,12 +429,10 @@ public: 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> @@ -559,8 +460,6 @@ inline bool operator<(const list<_Tp,_Alloc>& __x, __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) { @@ -592,10 +491,6 @@ swap(list<_Tp, _Alloc>& __x, 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, @@ -606,28 +501,6 @@ 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, @@ -688,8 +561,6 @@ void list<_Tp, _Alloc>::_M_fill_assign(size_type __n, const _Tp& __val) { 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, @@ -705,8 +576,6 @@ 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) { @@ -758,7 +627,7 @@ inline void __List_base_reverse(_List_node_base* __p) { _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); } @@ -794,8 +663,6 @@ void list<_Tp, _Alloc>::sort() } } -#ifdef __STL_MEMBER_TEMPLATES - template <class _Tp, class _Alloc> template <class _Predicate> void list<_Tp, _Alloc>::remove_if(_Predicate __pred) { @@ -869,14 +736,7 @@ void list<_Tp, _Alloc>::sort(_StrictWeakOrdering __comp) } } -#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 */ diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h index 0b7a06d4b8b..a725004618f 100644 --- a/libstdc++-v3/include/bits/stl_map.h +++ b/libstdc++-v3/include/bits/stl_map.h @@ -33,12 +33,8 @@ #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> > > @@ -94,7 +90,6 @@ public: 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()) @@ -104,27 +99,8 @@ public: 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) { @@ -164,19 +140,10 @@ public: { 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); } @@ -207,19 +174,12 @@ public: 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> @@ -234,8 +194,6 @@ inline bool operator<(const map<_Key,_Tp,_Compare,_Alloc>& __x, 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) { @@ -266,14 +224,7 @@ inline void swap(map<_Key,_Tp,_Compare,_Alloc>& __x, __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 */ diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h index 1c5401b378a..35d22634d27 100644 --- a/libstdc++-v3/include/bits/stl_multimap.h +++ b/libstdc++-v3/include/bits/stl_multimap.h @@ -33,12 +33,8 @@ #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. @@ -107,7 +103,6 @@ public: 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()) @@ -118,25 +113,8 @@ public: 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; @@ -168,19 +146,10 @@ public: 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) @@ -207,19 +176,12 @@ public: 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> @@ -234,8 +196,6 @@ inline bool operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, 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) { @@ -266,14 +226,7 @@ inline void swap(multimap<_Key,_Tp,_Compare,_Alloc>& __x, __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 */ diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h index 7e75ec3cd0a..8b2c63ff03b 100644 --- a/libstdc++-v3/include/bits/stl_multiset.h +++ b/libstdc++-v3/include/bits/stl_multiset.h @@ -33,12 +33,8 @@ #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. @@ -93,8 +89,6 @@ public: 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()) @@ -106,29 +100,8 @@ public: 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; @@ -159,19 +132,10 @@ public: 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); @@ -199,19 +163,12 @@ public: 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> @@ -226,8 +183,6 @@ inline bool operator<(const multiset<_Key,_Compare,_Alloc>& __x, 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) { @@ -258,14 +213,7 @@ inline void swap(multiset<_Key,_Compare,_Alloc>& __x, __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 */ diff --git a/libstdc++-v3/include/bits/stl_numeric.h b/libstdc++-v3/include/bits/stl_numeric.h index 0b1742bc9d9..0a084e54747 100644 --- a/libstdc++-v3/include/bits/stl_numeric.h +++ b/libstdc++-v3/include/bits/stl_numeric.h @@ -32,7 +32,8 @@ #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) @@ -246,7 +247,7 @@ iota(_ForwardIter __first, _ForwardIter __last, _Tp __value) *__first++ = __value++; } -__STL_END_NAMESPACE +} // namespace std #endif /* _CPP_BITS_STL_NUMERIC_H */ diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h index 236f916394f..8252d97e2be 100644 --- a/libstdc++-v3/include/bits/stl_pair.h +++ b/libstdc++-v3/include/bits/stl_pair.h @@ -31,7 +31,8 @@ #ifndef __SGI_STL_INTERNAL_PAIR_H #define __SGI_STL_INTERNAL_PAIR_H -__STL_BEGIN_NAMESPACE +namespace std +{ template <class _T1, class _T2> struct pair { @@ -43,10 +44,8 @@ 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> @@ -62,8 +61,6 @@ inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) (!(__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); @@ -84,8 +81,6 @@ inline bool operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __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 @@ -97,7 +92,7 @@ inline pair<_T1, _T2> make_pair(const _T1& __x, const _T2& __y) return pair<_T1, _T2>(__x, __y); } -__STL_END_NAMESPACE +} // namespace std #endif /* __SGI_STL_INTERNAL_PAIR_H */ diff --git a/libstdc++-v3/include/bits/stl_pthread_alloc.h b/libstdc++-v3/include/bits/stl_pthread_alloc.h index c1488b1ef6a..65879354f69 100644 --- a/libstdc++-v3/include/bits/stl_pthread_alloc.h +++ b/libstdc++-v3/include/bits/stl_pthread_alloc.h @@ -16,13 +16,8 @@ #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 */ diff --git a/libstdc++-v3/include/bits/stl_queue.h b/libstdc++-v3/include/bits/stl_queue.h index e42666e5662..d6ca8129465 100644 --- a/libstdc++-v3/include/bits/stl_queue.h +++ b/libstdc++-v3/include/bits/stl_queue.h @@ -33,7 +33,8 @@ #include <bits/sequence_concepts.h> -__STL_BEGIN_NAMESPACE +namespace std +{ // Forward declarations of operators < and ==, needed for friend declaration. @@ -60,20 +61,12 @@ class queue { __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; @@ -111,8 +104,6 @@ operator<(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y) 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) @@ -141,12 +132,9 @@ 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: @@ -174,7 +162,6 @@ 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); } @@ -194,24 +181,6 @@ public: 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(); } @@ -233,7 +202,7 @@ public: // no equality is provided -__STL_END_NAMESPACE +} // namespace std #endif /* __SGI_STL_INTERNAL_QUEUE_H */ diff --git a/libstdc++-v3/include/bits/stl_raw_storage_iter.h b/libstdc++-v3/include/bits/stl_raw_storage_iter.h index 007acd032ed..22fec74bcb8 100644 --- a/libstdc++-v3/include/bits/stl_raw_storage_iter.h +++ b/libstdc++-v3/include/bits/stl_raw_storage_iter.h @@ -31,7 +31,8 @@ #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 { @@ -61,18 +62,8 @@ public: } }; -#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 */ diff --git a/libstdc++-v3/include/bits/stl_relops.h b/libstdc++-v3/include/bits/stl_relops.h index 338194b5187..531137a677c 100644 --- a/libstdc++-v3/include/bits/stl_relops.h +++ b/libstdc++-v3/include/bits/stl_relops.h @@ -41,7 +41,10 @@ #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) { @@ -63,7 +66,8 @@ 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 */ diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h index 435ca38b16e..03bb1906921 100644 --- a/libstdc++-v3/include/bits/stl_set.h +++ b/libstdc++-v3/include/bits/stl_set.h @@ -33,12 +33,8 @@ #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. @@ -93,7 +89,6 @@ public: 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()) @@ -103,24 +98,6 @@ public: 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) @@ -153,19 +130,10 @@ public: 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); @@ -195,17 +163,10 @@ public: 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> @@ -220,8 +181,6 @@ inline bool operator<(const set<_Key,_Compare,_Alloc>& __x, 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) { @@ -252,14 +211,7 @@ inline void swap(set<_Key,_Compare,_Alloc>& __x, __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 */ diff --git a/libstdc++-v3/include/bits/stl_stack.h b/libstdc++-v3/include/bits/stl_stack.h index aa80f8730ee..72e67bde4da 100644 --- a/libstdc++-v3/include/bits/stl_stack.h +++ b/libstdc++-v3/include/bits/stl_stack.h @@ -33,7 +33,8 @@ #include <bits/sequence_concepts.h> -__STL_BEGIN_NAMESPACE +namespace std +{ // Forward declarations of operators == and <, needed for friend declaration. @@ -59,20 +60,12 @@ class stack { __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; @@ -106,8 +99,6 @@ bool operator<(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) 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) { @@ -132,9 +123,7 @@ 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 */ diff --git a/libstdc++-v3/include/bits/stl_tempbuf.h b/libstdc++-v3/include/bits/stl_tempbuf.h index cdc0dd27df0..e1c5334e42b 100644 --- a/libstdc++-v3/include/bits/stl_tempbuf.h +++ b/libstdc++-v3/include/bits/stl_tempbuf.h @@ -31,7 +31,8 @@ #ifndef __SGI_STL_INTERNAL_TEMPBUF_H #define __SGI_STL_INTERNAL_TEMPBUF_H -__STL_BEGIN_NAMESPACE +namespace std +{ template <class _Tp> pair<_Tp*, ptrdiff_t> @@ -50,15 +51,11 @@ __get_temporary_buffer(ptrdiff_t __len, _Tp*) 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 @@ -109,12 +106,8 @@ public: _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; @@ -141,9 +134,7 @@ private: 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> { @@ -152,7 +143,7 @@ struct temporary_buffer : public _Temporary_buffer<_ForwardIterator, _Tp> ~temporary_buffer() {} }; -__STL_END_NAMESPACE +} // namespace std #endif /* __SGI_STL_INTERNAL_TEMPBUF_H */ diff --git a/libstdc++-v3/include/bits/stl_threads.h b/libstdc++-v3/include/bits/stl_threads.h index b897a0ea277..e869a3fc21d 100644 --- a/libstdc++-v3/include/bits/stl_threads.h +++ b/libstdc++-v3/include/bits/stl_threads.h @@ -36,8 +36,8 @@ #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 @@ -365,7 +365,7 @@ private: _STL_auto_lock(const _STL_auto_lock&); }; -__STL_END_NAMESPACE +} // namespace std #endif /* __SGI_STL_INTERNAL_THREADS_H */ @@ -373,7 +373,3 @@ __STL_END_NAMESPACE // mode:C++ // End: - - - - diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h index f82f21c3c07..253734e60ec 100644 --- a/libstdc++-v3/include/bits/stl_tree.h +++ b/libstdc++-v3/include/bits/stl_tree.h @@ -58,11 +58,8 @@ iterators invalidated are those referring to the deleted node. #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; @@ -165,9 +162,7 @@ struct _Rb_tree_iterator : public _Rb_tree_base_iterator _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) { @@ -220,25 +215,6 @@ inline bool operator!=(const _Rb_tree_iterator<_Value, _Value&, _Value*>& __x, 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) { @@ -361,7 +337,7 @@ _Rb_tree_rebalance_for_erase(_Rb_tree_node_base* __z, 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 } @@ -459,8 +435,6 @@ _Rb_tree_rebalance_for_erase(_Rb_tree_node_base* __z, // 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 { @@ -519,30 +493,6 @@ struct _Rb_tree_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> > @@ -567,11 +517,9 @@ public: 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: @@ -648,17 +596,8 @@ public: 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); @@ -726,9 +665,9 @@ public: 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: @@ -739,17 +678,10 @@ 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); @@ -802,8 +734,6 @@ operator<(const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __x, __y.begin(), __y.end()); } -#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER - template <class _Key, class _Value, class _KeyOfValue, class _Compare, class _Alloc> inline bool @@ -846,8 +776,6 @@ swap(_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __x, __x.swap(__y); } -#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ - template <class _Key, class _Value, class _KeyOfValue, class _Compare, class _Alloc> @@ -1021,8 +949,6 @@ _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_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> @@ -1040,45 +966,6 @@ 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> @@ -1381,11 +1268,7 @@ struct rb_tree : public _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 */ diff --git a/libstdc++-v3/include/bits/stl_uninitialized.h b/libstdc++-v3/include/bits/stl_uninitialized.h index a9b196be347..acbf4ab80b8 100644 --- a/libstdc++-v3/include/bits/stl_uninitialized.h +++ b/libstdc++-v3/include/bits/stl_uninitialized.h @@ -33,7 +33,8 @@ #include <bits/std_cstring.h> -__STL_BEGIN_NAMESPACE +namespace std +{ // uninitialized_copy @@ -272,7 +273,7 @@ __uninitialized_copy_fill(_InputIter __first1, _InputIter __last1, __STL_UNWIND(_Destroy(__first2, __mid2)); } -__STL_END_NAMESPACE +} // namespace std #endif /* _CPP_BITS_STL_UNINITIALIZED_H */ diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h index 0c2997579e3..afdb1e3b59a 100644 --- a/libstdc++-v3/include/bits/stl_vector.h +++ b/libstdc++-v3/include/bits/stl_vector.h @@ -32,15 +32,10 @@ #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 @@ -48,8 +43,6 @@ __STL_BEGIN_NAMESPACE // 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 { @@ -119,39 +112,6 @@ struct _Vector_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> @@ -177,24 +137,15 @@ public: 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); @@ -228,7 +179,6 @@ public: 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"); @@ -238,7 +188,6 @@ public: { _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) {} @@ -256,7 +205,6 @@ public: : _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, @@ -278,13 +226,6 @@ public: _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); @@ -308,8 +249,6 @@ public: 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; @@ -332,8 +271,6 @@ public: 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); } @@ -356,9 +293,9 @@ public: _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) { @@ -381,7 +318,6 @@ public: _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) { @@ -400,10 +336,6 @@ public: __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); } @@ -439,33 +371,18 @@ public: 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) @@ -495,8 +412,6 @@ protected: void _M_range_insert(iterator __pos, _ForwardIterator __first, _ForwardIterator __last, forward_iterator_tag); - -#endif /* __STL_MEMBER_TEMPLATES */ }; template <class _Tp, class _Alloc> @@ -515,8 +430,6 @@ operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) __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) { @@ -547,8 +460,6 @@ operator>=(const vector<_Tp, _Alloc>& __x, const 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) @@ -590,8 +501,6 @@ void vector<_Tp, _Alloc>::_M_fill_assign(size_t __n, const value_type& __val) 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) { @@ -631,8 +540,6 @@ vector<_Tp, _Alloc>::_M_assign_aux(_ForwardIter __first, _ForwardIter __last, } } -#endif /* __STL_MEMBER_TEMPLATES */ - template <class _Tp, class _Alloc> void vector<_Tp, _Alloc>::_M_insert_aux(iterator __position, const _Tp& __x) @@ -746,8 +653,6 @@ void vector<_Tp, _Alloc>::_M_fill_insert(iterator __position, size_type __n, } } -#ifdef __STL_MEMBER_TEMPLATES - template <class _Tp, class _Alloc> template <class _InputIterator> void vector<_Tp, _Alloc>::_M_range_insert(iterator __pos, @@ -813,64 +718,7 @@ vector<_Tp, _Alloc>::_M_range_insert(iterator __position, } } -#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 */ diff --git a/libstdc++-v3/include/bits/streambuf.tcc b/libstdc++-v3/include/bits/streambuf.tcc index a4dfaab91bb..783fffeeed8 100644 --- a/libstdc++-v3/include/bits/streambuf.tcc +++ b/libstdc++-v3/include/bits/streambuf.tcc @@ -223,7 +223,3 @@ namespace std { #endif // _CPP_BITS_STREAMBUF_TCC - - - - diff --git a/libstdc++-v3/include/bits/type_traits.h b/libstdc++-v3/include/bits/type_traits.h index b683f315347..70b3522f059 100644 --- a/libstdc++-v3/include/bits/type_traits.h +++ b/libstdc++-v3/include/bits/type_traits.h @@ -86,14 +86,9 @@ struct __type_traits { }; +// 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; @@ -101,9 +96,7 @@ __STL_TEMPLATE_NULL struct __type_traits<bool> { 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; @@ -111,7 +104,7 @@ __STL_TEMPLATE_NULL struct __type_traits<char> { 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; @@ -119,7 +112,7 @@ __STL_TEMPLATE_NULL struct __type_traits<signed char> { 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; @@ -127,9 +120,7 @@ __STL_TEMPLATE_NULL struct __type_traits<unsigned char> { 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; @@ -137,9 +128,7 @@ __STL_TEMPLATE_NULL struct __type_traits<wchar_t> { 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; @@ -147,7 +136,7 @@ __STL_TEMPLATE_NULL struct __type_traits<short> { 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; @@ -155,7 +144,7 @@ __STL_TEMPLATE_NULL struct __type_traits<unsigned short> { 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; @@ -163,7 +152,7 @@ __STL_TEMPLATE_NULL struct __type_traits<int> { 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; @@ -171,7 +160,7 @@ __STL_TEMPLATE_NULL struct __type_traits<unsigned int> { 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; @@ -179,7 +168,7 @@ __STL_TEMPLATE_NULL struct __type_traits<long> { 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; @@ -187,9 +176,9 @@ __STL_TEMPLATE_NULL struct __type_traits<unsigned long> { 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; @@ -197,7 +186,7 @@ __STL_TEMPLATE_NULL struct __type_traits<long long> { 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; @@ -205,9 +194,9 @@ __STL_TEMPLATE_NULL struct __type_traits<unsigned long long> { 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; @@ -215,7 +204,7 @@ __STL_TEMPLATE_NULL struct __type_traits<float> { 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; @@ -223,7 +212,7 @@ __STL_TEMPLATE_NULL struct __type_traits<double> { 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; @@ -231,8 +220,6 @@ __STL_TEMPLATE_NULL struct __type_traits<long double> { 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; @@ -242,58 +229,6 @@ struct __type_traits<_Tp*> { 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. @@ -302,69 +237,61 @@ template <class _Tp> struct _Is_integer { 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; diff --git a/libstdc++-v3/include/bits/valarray_meta.h b/libstdc++-v3/include/bits/valarray_meta.h index be6a30a94b3..392dc9b7eb0 100644 --- a/libstdc++-v3/include/bits/valarray_meta.h +++ b/libstdc++-v3/include/bits/valarray_meta.h @@ -1,6 +1,6 @@ // 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 @@ -34,7 +34,8 @@ #pragma GCC system_header -namespace std { +namespace std +{ // // Implementing a loosened valarray return value is tricky. diff --git a/libstdc++-v3/include/ext/bvector b/libstdc++-v3/include/ext/bvector index 32a06d21be1..d40fe50a5b5 100644 --- a/libstdc++-v3/include/ext/bvector +++ b/libstdc++-v3/include/ext/bvector @@ -31,11 +31,7 @@ #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 */ diff --git a/libstdc++-v3/include/ext/hash_map b/libstdc++-v3/include/ext/hash_map index ae3cf2672bc..cbaf1d6a07a 100644 --- a/libstdc++-v3/include/ext/hash_map +++ b/libstdc++-v3/include/ext/hash_map @@ -33,12 +33,8 @@ #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. @@ -95,7 +91,6 @@ public: 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()) @@ -116,54 +111,15 @@ public: : _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> @@ -175,17 +131,9 @@ public: 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); } @@ -225,8 +173,6 @@ operator==(const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1, 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, @@ -242,8 +188,6 @@ swap(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, @@ -306,7 +250,6 @@ public: 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()) @@ -327,54 +270,15 @@ public: : _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(); } @@ -384,17 +288,9 @@ public: 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); } @@ -431,8 +327,6 @@ operator==(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1, 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, @@ -448,13 +342,10 @@ swap(hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_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: @@ -508,14 +399,7 @@ public: 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 */ diff --git a/libstdc++-v3/include/ext/hash_set b/libstdc++-v3/include/ext/hash_set index 24869cd030c..aedf1b5f565 100644 --- a/libstdc++-v3/include/ext/hash_set +++ b/libstdc++-v3/include/ext/hash_set @@ -35,12 +35,8 @@ #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. @@ -102,7 +98,6 @@ public: 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()) @@ -122,40 +117,6 @@ public: 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(); } @@ -163,14 +124,9 @@ public: 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(); } @@ -181,17 +137,9 @@ public: 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 = @@ -227,8 +175,6 @@ operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1, 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, @@ -244,8 +190,6 @@ swap(hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1, __hs1.swap(__hs2); } -#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ - template <class _Value, class _HashFcn = hash<_Value>, @@ -306,7 +250,6 @@ public: 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()) @@ -326,40 +269,6 @@ public: 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(); } @@ -367,14 +276,9 @@ public: 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(); } @@ -382,17 +286,9 @@ public: 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); } @@ -424,8 +320,6 @@ operator==(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1, 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, @@ -440,13 +334,9 @@ swap(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: @@ -500,14 +390,7 @@ public: 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 */ diff --git a/libstdc++-v3/include/ext/ropeimpl.h b/libstdc++-v3/include/ext/ropeimpl.h index cc4d7bc679e..7f790f64211 100644 --- a/libstdc++-v3/include/ext/ropeimpl.h +++ b/libstdc++-v3/include/ext/ropeimpl.h @@ -15,23 +15,15 @@ * 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. @@ -303,26 +295,16 @@ inline void _Rope_RopeRep<_CharT,_Alloc>::_M_free_c_string() 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 } @@ -375,13 +357,8 @@ void _Rope_RopeRep<_CharT,_Alloc>::_M_free_tree() #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 @@ -456,9 +433,7 @@ rope<_CharT,_Alloc>::_S_tree_concat (_RopeRep* __left, _RopeRep* __right) _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; @@ -791,22 +766,11 @@ class _Rope_find_char_char_consumer : public _Rope_char_consumer<_CharT> { } }; -#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) @@ -817,38 +781,15 @@ class _Rope_insert_char_consumer : public _Rope_char_consumer<_CharT> { // 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( @@ -908,12 +849,8 @@ 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; @@ -926,25 +863,15 @@ template <class _CharT> inline bool _Rope_is_simple(_CharT*) { return false; } 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) { @@ -1575,12 +1502,7 @@ inline void rotate( } # 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++ diff --git a/libstdc++-v3/include/ext/slist b/libstdc++-v3/include/ext/slist index ef0906279a9..3c70c5cc1d5 100644 --- a/libstdc++-v3/include/ext/slist +++ b/libstdc++-v3/include/ext/slist @@ -21,12 +21,8 @@ #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 { @@ -149,9 +145,7 @@ struct _Slist_iterator : public _Slist_iterator_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++() { @@ -166,22 +160,6 @@ struct _Slist_iterator : public _Slist_iterator_base } }; -#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 @@ -190,8 +168,6 @@ inline _Tp* value_type(const _Slist_iterator<_Tp, _Ref, _Ptr>&) { // 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 { @@ -263,38 +239,6 @@ protected: _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, @@ -310,7 +254,7 @@ _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: @@ -369,7 +313,6 @@ public: 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> @@ -377,15 +320,6 @@ public: 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()); } @@ -404,9 +338,6 @@ public: 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; @@ -421,8 +352,6 @@ public: 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); } @@ -450,7 +379,7 @@ public: 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: @@ -491,8 +420,6 @@ private: __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, @@ -517,26 +444,6 @@ private: } } -#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) { @@ -551,8 +458,6 @@ public: _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> @@ -560,19 +465,6 @@ public: _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), @@ -590,8 +482,6 @@ public: __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> @@ -600,21 +490,6 @@ public: __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)); @@ -700,7 +575,6 @@ public: void merge(slist& __x); void sort(); -#ifdef __STL_MEMBER_TEMPLATES template <class _Predicate> void remove_if(_Predicate __pred); @@ -712,7 +586,6 @@ public: template <class _StrictWeakOrdering> void sort(_StrictWeakOrdering __comp); -#endif /* __STL_MEMBER_TEMPLATES */ }; template <class _Tp, class _Alloc> @@ -752,8 +625,6 @@ void slist<_Tp, _Alloc>::_M_fill_assign(size_type __n, const _Tp& __val) { 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, @@ -773,8 +644,6 @@ 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) @@ -801,8 +670,6 @@ 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) { @@ -832,8 +699,6 @@ inline void swap(slist<_Tp,_Alloc>& __x, slist<_Tp,_Alloc>& __y) { __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) @@ -919,8 +784,6 @@ void slist<_Tp,_Alloc>::sort() } } -#ifdef __STL_MEMBER_TEMPLATES - template <class _Tp, class _Alloc> template <class _Predicate> void slist<_Tp,_Alloc>::remove_if(_Predicate __pred) @@ -993,13 +856,9 @@ void slist<_Tp,_Alloc>::sort(_StrictWeakOrdering __comp) } } -#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: @@ -1032,14 +891,7 @@ public: 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 */ diff --git a/libstdc++-v3/include/ext/stl_bvector.h b/libstdc++-v3/include/ext/stl_bvector.h index 90787012898..7b768a4c3ed 100644 --- a/libstdc++-v3/include/ext/stl_bvector.h +++ b/libstdc++-v3/include/ext/stl_bvector.h @@ -31,15 +31,11 @@ #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; @@ -245,8 +241,6 @@ operator+(ptrdiff_t __n, const _Bit_const_iterator& __x) { return __x + __n; } // 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 { @@ -317,577 +311,385 @@ public: ~_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 */ diff --git a/libstdc++-v3/include/ext/stl_hash_fun.h b/libstdc++-v3/include/ext/stl_hash_fun.h index 3144e6a07f1..f5260b01290 100644 --- a/libstdc++-v3/include/ext/stl_hash_fun.h +++ b/libstdc++-v3/include/ext/stl_hash_fun.h @@ -33,7 +33,8 @@ #include <bits/std_cstddef.h> -__STL_BEGIN_NAMESPACE +namespace std +{ template <class _Key> struct hash { }; @@ -46,45 +47,45 @@ inline size_t __stl_hash_string(const char* __s) 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 */ diff --git a/libstdc++-v3/include/ext/stl_hashtable.h b/libstdc++-v3/include/ext/stl_hashtable.h index ab5cf5203b1..ff903807fb4 100644 --- a/libstdc++-v3/include/ext/stl_hashtable.h +++ b/libstdc++-v3/include/ext/stl_hashtable.h @@ -44,7 +44,8 @@ #include <bits/stl_vector.h> #include <ext/stl_hash_fun.h> -__STL_BEGIN_NAMESPACE +namespace std +{ template <class _Val> struct _Hashtable_node @@ -92,9 +93,7 @@ struct _Hashtable_iterator { : _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 @@ -133,9 +132,7 @@ struct _Hashtable_const_iterator { _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 @@ -205,7 +202,6 @@ public: 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; } @@ -213,17 +209,6 @@ private: 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; @@ -250,7 +235,7 @@ public: 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), @@ -264,7 +249,7 @@ public: 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()), @@ -275,7 +260,7 @@ public: } 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), @@ -285,8 +270,6 @@ public: _M_copy_from(__ht); } -#undef __HASH_ALLOC_INIT - hashtable& operator= (const hashtable& __ht) { if (&__ht != this) { @@ -307,11 +290,11 @@ public: 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() @@ -334,15 +317,9 @@ public: 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(); } @@ -373,7 +350,6 @@ public: 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) { @@ -424,42 +400,6 @@ public: 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) @@ -617,59 +557,6 @@ _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++(int) 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) @@ -689,8 +576,6 @@ bool operator==(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1, 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) { @@ -704,8 +589,6 @@ inline void swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1, __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> @@ -1045,7 +928,7 @@ void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> __STL_UNWIND(clear()); } -__STL_END_NAMESPACE +} // namespace std #endif /* __SGI_STL_INTERNAL_HASHTABLE_H */ diff --git a/libstdc++-v3/include/ext/stl_rope.h b/libstdc++-v3/include/ext/stl_rope.h index f317f3a6fbc..d3d3ccf449e 100644 --- a/libstdc++-v3/include/ext/stl_rope.h +++ b/libstdc++-v3/include/ext/stl_rope.h @@ -34,11 +34,8 @@ # 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. @@ -97,20 +94,10 @@ class char_producer { // 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]; @@ -208,7 +195,7 @@ class _Rope_char_consumer { // 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; @@ -374,8 +361,6 @@ identity_element(_Rope_Concat_fn<_CharT, _Alloc>) // 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. @@ -445,32 +430,6 @@ struct _Rope_rep_base : _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> @@ -504,14 +463,9 @@ 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 @@ -814,32 +768,13 @@ class _Rope_char_ref_proxy { } }; -#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 { @@ -862,15 +797,9 @@ 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); } @@ -886,10 +815,6 @@ class _Rope_char_ptr_proxy { // 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> { @@ -966,10 +891,8 @@ template<class _CharT, class _Alloc> 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) @@ -1045,7 +968,6 @@ class _Rope_const_iterator : public _Rope_iterator_base<_CharT,_Alloc> { _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, @@ -1058,23 +980,10 @@ class _Rope_const_iterator : public _Rope_iterator_base<_CharT,_Alloc> { 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, @@ -1087,17 +996,6 @@ class _Rope_const_iterator : public _Rope_iterator_base<_CharT,_Alloc> { 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> @@ -1201,7 +1099,6 @@ class _Rope_iterator : public _Rope_iterator_base<_CharT,_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, @@ -1226,38 +1123,12 @@ class _Rope_iterator : public _Rope_iterator_base<_CharT,_Alloc> { 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 { @@ -1332,33 +1203,6 @@ struct _Rope_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> { @@ -1384,9 +1228,7 @@ 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]; @@ -1494,11 +1336,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { 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); } @@ -1506,22 +1344,14 @@ class rope : public _Rope_base<_CharT,_Alloc> { _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); } @@ -1529,35 +1359,18 @@ class rope : public _Rope_base<_CharT,_Alloc> { _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]); @@ -1734,9 +1547,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { 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); @@ -1893,12 +1704,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { // 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()); @@ -1916,7 +1722,6 @@ class rope : public _Rope_base<_CharT,_Alloc> { 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, @@ -1930,19 +1735,6 @@ class rope : public _Rope_base<_CharT,_Alloc> { 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. @@ -1973,9 +1765,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { 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 = @@ -1996,9 +1786,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { 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; @@ -2011,9 +1799,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { } 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; @@ -2031,9 +1817,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { _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 { @@ -2047,9 +1831,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { 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; } @@ -2314,12 +2096,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { 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()); @@ -2397,8 +2174,6 @@ inline bool operator< (const _Rope_const_iterator<_CharT,_Alloc>& __x, 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) { @@ -2423,8 +2198,6 @@ inline bool operator>= (const _Rope_const_iterator<_CharT,_Alloc>& __x, 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) { @@ -2465,8 +2238,6 @@ inline bool operator< (const _Rope_iterator<_CharT,_Alloc>& __x, 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) { @@ -2491,8 +2262,6 @@ inline bool operator>= (const _Rope_iterator<_CharT,_Alloc>& __x, 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) { @@ -2528,9 +2297,7 @@ rope<_CharT,_Alloc> 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 @@ -2604,8 +2371,6 @@ inline bool operator== (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x, 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) { @@ -2636,18 +2401,11 @@ inline bool operator!= (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x, 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; @@ -2661,22 +2419,13 @@ inline wrope::reference __mutable_reference_at(wrope& __c, size_t __i) 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 { @@ -2688,7 +2437,7 @@ __STL_TEMPLATE_NULL struct hash<crope> }; -__STL_TEMPLATE_NULL struct hash<wrope> +template<> struct hash<wrope> { size_t operator()(const wrope& __str) const { @@ -2699,11 +2448,7 @@ __STL_TEMPLATE_NULL struct hash<wrope> } }; -#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1174 -#endif - -__STL_END_NAMESPACE +} // namespace std # include <ext/ropeimpl.h> diff --git a/libstdc++-v3/src/complex_io.cc b/libstdc++-v3/src/complex_io.cc index aae347c2755..944414f0c0b 100644 --- a/libstdc++-v3/src/complex_io.cc +++ b/libstdc++-v3/src/complex_io.cc @@ -147,13 +147,5 @@ namespace std operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<long double>&); #endif //_GLIBCPP_USE_WCHAR_T -} - - - - - - - - +} // namespace std diff --git a/libstdc++-v3/src/ios.cc b/libstdc++-v3/src/ios.cc index b6ab7663ed0..8d78a636710 100644 --- a/libstdc++-v3/src/ios.cc +++ b/libstdc++-v3/src/ios.cc @@ -351,14 +351,3 @@ namespace std } // namespace std - - - - - - - - - - - diff --git a/libstdc++-v3/src/locale-inst.cc b/libstdc++-v3/src/locale-inst.cc index b6cd5252be3..554fab3f258 100644 --- a/libstdc++-v3/src/locale-inst.cc +++ b/libstdc++-v3/src/locale-inst.cc @@ -42,7 +42,8 @@ #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; @@ -303,5 +304,5 @@ namespace std { fill(__normal_iterator<locale::facet**, vector<locale::facet*> >, __normal_iterator<locale::facet**, vector<locale::facet*> >, locale::facet* const&); -} +} // namespace std diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc index c5198041bcf..3b430904d33 100644 --- a/libstdc++-v3/src/locale.cc +++ b/libstdc++-v3/src/locale.cc @@ -1234,8 +1234,3 @@ namespace std #endif // _GLIBCPP_USE_WCHAR_T } // namespace std - - - - - diff --git a/libstdc++-v3/src/localename.cc b/libstdc++-v3/src/localename.cc index c1aab916f71..e4bc18fefe6 100644 --- a/libstdc++-v3/src/localename.cc +++ b/libstdc++-v3/src/localename.cc @@ -31,7 +31,8 @@ #include <bits/std_vector.h> #include <bits/std_stdexcept.h> -namespace std { +namespace std +{ locale::_Impl:: ~_Impl() throw() { @@ -196,8 +197,5 @@ namespace std { } } } -} - - - +} // namespace std diff --git a/libstdc++-v3/src/misc-inst.cc b/libstdc++-v3/src/misc-inst.cc index ffcad595b41..50d11abb440 100644 --- a/libstdc++-v3/src/misc-inst.cc +++ b/libstdc++-v3/src/misc-inst.cc @@ -54,7 +54,8 @@ #include <bits/ostream.tcc> #endif -namespace std { +namespace std +{ // // streambuf diff --git a/libstdc++-v3/src/stdexcept.cc b/libstdc++-v3/src/stdexcept.cc index 9a3f2dd574b..32ebd265f89 100644 --- a/libstdc++-v3/src/stdexcept.cc +++ b/libstdc++-v3/src/stdexcept.cc @@ -76,6 +76,3 @@ namespace std : runtime_error(__arg) { } } // namespace std - - - diff --git a/libstdc++-v3/src/stl-inst.cc b/libstdc++-v3/src/stl-inst.cc index 319aebb0028..29337c02bbf 100644 --- a/libstdc++-v3/src/stl-inst.cc +++ b/libstdc++-v3/src/stl-inst.cc @@ -35,7 +35,8 @@ #include <bits/stl_alloc.h> #include <bits/std_vector.h> -namespace std { +namespace std +{ template class __malloc_alloc_template<0>; diff --git a/libstdc++-v3/src/strstream.cc b/libstdc++-v3/src/strstream.cc index ba5e8470a50..10d23b0259c 100644 --- a/libstdc++-v3/src/strstream.cc +++ b/libstdc++-v3/src/strstream.cc @@ -24,7 +24,8 @@ #include <string.h> #include <limits.h> -__STL_BEGIN_NAMESPACE +namespace std +{ // strstreambuf constructor, destructor. @@ -420,7 +421,7 @@ char* strstream::str() return _M_buf.str(); } -__STL_END_NAMESPACE +} // namespace std // Local Variables: // mode:C++ diff --git a/libstdc++-v3/src/valarray-inst.cc b/libstdc++-v3/src/valarray-inst.cc index 9950fbadd0b..9e51ca57835 100644 --- a/libstdc++-v3/src/valarray-inst.cc +++ b/libstdc++-v3/src/valarray-inst.cc @@ -1,3 +1,36 @@ +// 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 @@ -81,4 +114,5 @@ namespace std _M_index(__l.size() == 0 ? 0 : __valarray_product(__l)) { __gslice_to_index(__o, __l, __s, _M_index); } -} +} // namespace std + |