1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // In most .h files, we would rather include a declaration of an stl
6 // rather than including the appropriate stl h file (which brings in
7 // lots of noise). For many STL classes this is ok (eg pair), but for
8 // some it's really annoying. We define those here, so you can
9 // just include this file instead of having to deal with the annoyance.
11 // Most of the annoyance, btw, has to do with the default allocator.
13 #ifndef _STL_DECL_MSVC_H
14 #define _STL_DECL_MSVC_H
16 // VC++ namespace / STL issues; make them explicit
32 // copy_n isn't to be found anywhere in MSVC's STL
33 template <typename InputIterator
, typename Size
, typename OutputIterator
>
34 std::pair
<InputIterator
, OutputIterator
>
35 copy_n(InputIterator in
, Size count
, OutputIterator out
) {
36 for ( ; count
> 0; --count
) {
41 return std::make_pair(in
, out
);
44 // Nor are the following selectors
47 inline const T
& operator()(const T
& t
) const { return t
; }
50 // Copied from STLport
51 template <class _Pair
>
52 struct select1st
: public std::unary_function
<_Pair
, typename
_Pair::first_type
> {
53 const typename
_Pair::first_type
& operator()(const _Pair
& __x
) const {
58 template <class _Pair
>
59 struct select2nd
: public std::unary_function
<_Pair
, typename
_Pair::second_type
>
61 const typename
_Pair::second_type
& operator()(const _Pair
& __x
) const {
69 // If you compile on Windows and get a compile-time error because
70 // some google3 code specifies a 3rd or 4th parameter to one of
71 // these template classes, then you have to put in some #ifdefs
72 // and use the NATIVE_HASH_NAMESPACE::hash_(set|map) implementation.
74 template <typename Key
>
78 class HashFcn
= hash
<Key
> >
81 template <class Key
, class Val
,
82 class HashFcn
= hash
<Key
> >
86 class HashFcn
= hash
<Key
> >
89 template <class Key
, class Val
,
90 class HashFcn
= hash
<Key
> >
92 } // end namespace msvchash
94 using msvchash::hash_set
;
95 using msvchash::hash_map
;
97 using msvchash::hash_multimap
;
98 using msvchash::hash_multiset
;
107 #endif /* #ifdef _STL_DECL_MSVC_H */