| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////// |
|
2
|
|
|
|
|
|
|
// |
|
3
|
|
|
|
|
|
|
// (C) Copyright Ion Gaztanaga 2014-2015. Distributed under the Boost |
|
4
|
|
|
|
|
|
|
// Software License, Version 1.0. (See accompanying file |
|
5
|
|
|
|
|
|
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
|
6
|
|
|
|
|
|
|
// |
|
7
|
|
|
|
|
|
|
// See http://www.boost.org/libs/container for documentation. |
|
8
|
|
|
|
|
|
|
// |
|
9
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////// |
|
10
|
|
|
|
|
|
|
#ifndef BOOST_CONTAINER_DETAIL_NEXT_CAPACITY_HPP |
|
11
|
|
|
|
|
|
|
#define BOOST_CONTAINER_DETAIL_NEXT_CAPACITY_HPP |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#ifndef BOOST_CONFIG_HPP |
|
14
|
|
|
|
|
|
|
# include |
|
15
|
|
|
|
|
|
|
#endif |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#if defined(BOOST_HAS_PRAGMA_ONCE) |
|
18
|
|
|
|
|
|
|
# pragma once |
|
19
|
|
|
|
|
|
|
#endif |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
// container |
|
22
|
|
|
|
|
|
|
#include |
|
23
|
|
|
|
|
|
|
// container/detail |
|
24
|
|
|
|
|
|
|
#include |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
#include |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
namespace boost { |
|
29
|
|
|
|
|
|
|
namespace container { |
|
30
|
|
|
|
|
|
|
namespace dtl { |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
template |
|
33
|
|
|
|
|
|
|
struct grow_factor_ratio |
|
34
|
|
|
|
|
|
|
{ |
|
35
|
|
|
|
|
|
|
BOOST_STATIC_ASSERT(Numerator > Denominator); |
|
36
|
|
|
|
|
|
|
BOOST_STATIC_ASSERT(Numerator < 100); |
|
37
|
|
|
|
|
|
|
BOOST_STATIC_ASSERT(Denominator < 100); |
|
38
|
|
|
|
|
|
|
BOOST_STATIC_ASSERT(Denominator == 1 || (0 != Numerator % Denominator)); |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
template |
|
41
|
0
|
|
|
|
|
|
SizeType operator()(const SizeType cur_cap, const SizeType add_min_cap, const SizeType max_cap) const |
|
42
|
|
|
|
|
|
|
{ |
|
43
|
0
|
|
|
|
|
|
const SizeType overflow_limit = ((SizeType)-1) / Numerator; |
|
44
|
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
SizeType new_cap = 0; |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
if(cur_cap <= overflow_limit){ |
|
48
|
0
|
|
|
|
|
|
new_cap = cur_cap * Numerator / Denominator; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
0
|
0
|
|
|
|
|
else if(Denominator == 1 || (SizeType(new_cap = cur_cap) / Denominator) > overflow_limit){ |
|
51
|
0
|
|
|
|
|
|
new_cap = (SizeType)-1; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
else{ |
|
54
|
0
|
|
|
|
|
|
new_cap *= Numerator; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
0
|
|
|
|
|
|
return max_value(SizeType(Minimum), max_value(cur_cap+add_min_cap, min_value(max_cap, new_cap))); |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
}; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
} //namespace dtl { |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
struct growth_factor_50 |
|
63
|
|
|
|
|
|
|
: dtl::grow_factor_ratio<0, 3, 2> |
|
64
|
|
|
|
|
|
|
{}; |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
struct growth_factor_60 |
|
67
|
|
|
|
|
|
|
: dtl::grow_factor_ratio<0, 8, 5> |
|
68
|
|
|
|
|
|
|
{}; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
struct growth_factor_100 |
|
71
|
|
|
|
|
|
|
: dtl::grow_factor_ratio<0, 2, 1> |
|
72
|
|
|
|
|
|
|
{}; |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
} //namespace container { |
|
75
|
|
|
|
|
|
|
} //namespace boost { |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
#endif //#ifndef BOOST_CONTAINER_DETAIL_NEXT_CAPACITY_HPP |