xref: /trunk/main/stlport/systemstl/vector (revision 91144cd0085a7583d2099b982122deb2184ab956)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22#ifndef SYSTEM_STL_VECTOR
23#define SYSTEM_STL_VECTOR
24
25#ifdef HAVE_STL_INCLUDE_PATH
26    // TODO: use computed include file name
27    #include_next <vector>
28#elif defined(_MSC_VER) && (_MSC_VER >= 1900)
29    /*  A modern MSVC keeps the standard headers in <toolset>/include, and this
30        file shadows <vector> on the include path, so the real one has to be reached
31        explicitly. The path below resolves against the toolset's own include
32        directory and against nothing else on the search path -- the same trick
33        the VC9 branch uses, retargeted at the layout a modern toolset has.
34        #include_next, used by the branches around this one, is a GCC extension
35        that MSVC does not have. */
36    #include <../include/vector>
37#elif defined(__cplusplus) && (__cplusplus >= 201103L)
38    #include_next <vector>
39#elif defined(_MSC_VER)
40    #include <../../VC/include/vector>
41#else // fall back to boost/tr1
42    #include <boost/tr1/tr1/vector>
43#endif
44
45
46#ifndef NO_STLPORT4_EMULATION
47
48namespace std
49{
50    typedef vector<bool> bit_vector;
51}
52
53// workaround some STL implementations having problems with their vector<bool>::count() specialization
54inline int std_bitset_count( std::bit_vector::const_iterator it, std::bit_vector::const_iterator itEnd, bool bValue)
55{
56#if 0 && defined(_LIBCPP___BIT_REFERENCE) // TODO: reenable for libc++ >= r156543/r156546/etc.
57    int nCount = std::count( it, itEnd, bValue);
58#else
59    int nCount = 0;
60    for(; it != itEnd; ++it)
61        if( *it == bValue)
62            ++nCount;
63#endif
64    return nCount;
65}
66
67#endif // NO_STLPORT4_EMULATION
68
69#endif
70
71