Skip to content

Commit f67dfeb

Browse files
author
Tor Didriksen
committed
Bug#35805629 Bundle boost headers [sources]
Add extra/boost/boost_1_77_0/ Unpack boost_1_73_0.tar.bz2 rm 'extra/boost/boost_1_77_0/boost/serialization/collection_size_type copy.hpp' chmod -x extra/boost/boost_1_77_0/boost/geometry/algorithms/detail/buffer/buffer_box.hpp chmod -x extra/boost/boost_1_77_0/boost/parameter/aux_/python/invoker.hpp chmod -x extra/boost/boost_1_77_0/boost/parameter/aux_/python/invoker_iterate.hpp chmod -x extra/boost/boost_1_77_0/boost/parameter/python.hpp Remove directories that we do not use/need. Top level header files were also removed: accumulators align asio atomic beast bimap callable_traits chrono circular_buffer compatibility compute context contract convert coroutine coroutine2 date_time describe dll dynamic_bitset fiber filesystem flyweight format gil hana heap histogram hof icl interprocess io iostreams json lambda2 local_function lockfree log logic metaparse mpi msm multi_array nowide outcome pfr poly_collection polygon pool process program_options ptr_conntainer python random ratio safe_numerics signals2 sort stacktrace statechart static_string stl_interfaces system test thread timer tti type_erasure units uuid variant2 vmd wave yap Change-Id: Ic91995821e30bb4574fdecf7c3d8769612167d7b
1 parent ca63b44 commit f67dfeb

File tree

8,641 files changed

+1916582
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

8,641 files changed

+1916582
-0
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/*
2+
Copyright (c) Marshall Clow 2014.
3+
4+
Distributed under the Boost Software License, Version 1.0. (See accompanying
5+
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6+
7+
Revision history:
8+
2 Dec 2014 mtc First version; power
9+
10+
*/
11+
12+
/// \file algorithm.hpp
13+
/// \brief Misc Algorithms
14+
/// \author Marshall Clow
15+
///
16+
17+
#ifndef BOOST_ALGORITHM_HPP
18+
#define BOOST_ALGORITHM_HPP
19+
20+
#include <functional> // for plus and multiplies
21+
22+
#include <boost/config.hpp>
23+
#include <boost/utility/enable_if.hpp> // for boost::disable_if
24+
#include <boost/type_traits/is_integral.hpp>
25+
26+
namespace boost { namespace algorithm {
27+
28+
template <typename T>
29+
BOOST_CXX14_CONSTEXPR T identity_operation ( std::multiplies<T> ) { return T(1); }
30+
31+
template <typename T>
32+
BOOST_CXX14_CONSTEXPR T identity_operation ( std::plus<T> ) { return T(0); }
33+
34+
35+
/// \fn power ( T x, Integer n )
36+
/// \return the value "x" raised to the power "n"
37+
///
38+
/// \param x The value to be exponentiated
39+
/// \param n The exponent (must be >= 0)
40+
///
41+
// \remark Taken from Knuth, The Art of Computer Programming, Volume 2:
42+
// Seminumerical Algorithms, Section 4.6.3
43+
template <typename T, typename Integer>
44+
BOOST_CXX14_CONSTEXPR typename boost::enable_if<boost::is_integral<Integer>, T>::type
45+
power (T x, Integer n) {
46+
T y = 1; // Should be "T y{1};"
47+
if (n == 0) return y;
48+
while (true) {
49+
if (n % 2 == 1) {
50+
y = x * y;
51+
if (n == 1)
52+
return y;
53+
}
54+
n = n / 2;
55+
x = x * x;
56+
}
57+
return y;
58+
}
59+
60+
/// \fn power ( T x, Integer n, Operation op )
61+
/// \return the value "x" raised to the power "n"
62+
/// using the operation "op".
63+
///
64+
/// \param x The value to be exponentiated
65+
/// \param n The exponent (must be >= 0)
66+
/// \param op The operation used
67+
///
68+
// \remark Taken from Knuth, The Art of Computer Programming, Volume 2:
69+
// Seminumerical Algorithms, Section 4.6.3
70+
template <typename T, typename Integer, typename Operation>
71+
BOOST_CXX14_CONSTEXPR typename boost::enable_if<boost::is_integral<Integer>, T>::type
72+
power (T x, Integer n, Operation op) {
73+
T y = identity_operation(op);
74+
if (n == 0) return y;
75+
while (true) {
76+
if (n % 2 == 1) {
77+
y = op(x, y);
78+
if (n == 1)
79+
return y;
80+
}
81+
n = n / 2;
82+
x = op(x, x);
83+
}
84+
return y;
85+
}
86+
87+
}}
88+
89+
#endif // BOOST_ALGORITHM_HPP
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
/*
2+
Copyright (c) Alexander Zaitsev <[email protected]>, 2017
3+
4+
Distributed under the Boost Software License, Version 1.0. (See
5+
accompanying file LICENSE_1_0.txt or copy at
6+
http://www.boost.org/LICENSE_1_0.txt)
7+
8+
See http://www.boost.org/ for latest version.
9+
10+
11+
Based on https://blogs.msdn.microsoft.com/oldnewthing/20170104-00/?p=95115
12+
*/
13+
14+
/// \file apply_permutation.hpp
15+
/// \brief Apply permutation to a sequence.
16+
/// \author Alexander Zaitsev
17+
18+
#ifndef BOOST_ALGORITHM_APPLY_PERMUTATION_HPP
19+
#define BOOST_ALGORITHM_APPLY_PERMUTATION_HPP
20+
21+
#include <algorithm>
22+
23+
#include <boost/config.hpp>
24+
#include <boost/range/begin.hpp>
25+
#include <boost/range/end.hpp>
26+
27+
namespace boost { namespace algorithm
28+
{
29+
30+
/// \fn apply_permutation ( RandomAccessIterator1 item_begin, RandomAccessIterator1 item_end, RandomAccessIterator2 ind_begin )
31+
/// \brief Reorder item sequence with index sequence order
32+
///
33+
/// \param item_begin The start of the item sequence
34+
/// \param item_end One past the end of the item sequence
35+
/// \param ind_begin The start of the index sequence.
36+
///
37+
/// \note Item sequence size should be equal to index size. Otherwise behavior is undefined.
38+
/// Complexity: O(N).
39+
template<typename RandomAccessIterator1, typename RandomAccessIterator2>
40+
void
41+
apply_permutation(RandomAccessIterator1 item_begin, RandomAccessIterator1 item_end,
42+
RandomAccessIterator2 ind_begin, RandomAccessIterator2 ind_end)
43+
{
44+
typedef typename std::iterator_traits<RandomAccessIterator1>::difference_type Diff;
45+
typedef typename std::iterator_traits<RandomAccessIterator2>::difference_type Index;
46+
using std::swap;
47+
Diff size = std::distance(item_begin, item_end);
48+
for (Diff i = 0; i < size; i++)
49+
{
50+
Diff current = i;
51+
while (i != ind_begin[current])
52+
{
53+
Index next = ind_begin[current];
54+
swap(item_begin[current], item_begin[next]);
55+
ind_begin[current] = current;
56+
current = next;
57+
}
58+
ind_begin[current] = current;
59+
}
60+
}
61+
62+
/// \fn apply_reverse_permutation ( RandomAccessIterator1 item_begin, RandomAccessIterator1 item_end, RandomAccessIterator2 ind_begin )
63+
/// \brief Reorder item sequence with index sequence order
64+
///
65+
/// \param item_begin The start of the item sequence
66+
/// \param item_end One past the end of the item sequence
67+
/// \param ind_begin The start of the index sequence.
68+
///
69+
/// \note Item sequence size should be equal to index size. Otherwise behavior is undefined.
70+
/// Complexity: O(N).
71+
template<typename RandomAccessIterator1, typename RandomAccessIterator2>
72+
void
73+
apply_reverse_permutation(
74+
RandomAccessIterator1 item_begin,
75+
RandomAccessIterator1 item_end,
76+
RandomAccessIterator2 ind_begin,
77+
RandomAccessIterator2 ind_end)
78+
{
79+
typedef typename std::iterator_traits<RandomAccessIterator2>::difference_type Diff;
80+
using std::swap;
81+
Diff length = std::distance(item_begin, item_end);
82+
for (Diff i = 0; i < length; i++)
83+
{
84+
while (i != ind_begin[i])
85+
{
86+
Diff next = ind_begin[i];
87+
swap(item_begin[i], item_begin[next]);
88+
swap(ind_begin[i], ind_begin[next]);
89+
}
90+
}
91+
}
92+
93+
/// \fn apply_permutation ( Range1 item_range, Range2 ind_range )
94+
/// \brief Reorder item sequence with index sequence order
95+
///
96+
/// \param item_range The item sequence
97+
/// \param ind_range The index sequence
98+
///
99+
/// \note Item sequence size should be equal to index size. Otherwise behavior is undefined.
100+
/// Complexity: O(N).
101+
template<typename Range1, typename Range2>
102+
void
103+
apply_permutation(Range1& item_range, Range2& ind_range)
104+
{
105+
apply_permutation(boost::begin(item_range), boost::end(item_range),
106+
boost::begin(ind_range), boost::end(ind_range));
107+
}
108+
109+
/// \fn apply_reverse_permutation ( Range1 item_range, Range2 ind_range )
110+
/// \brief Reorder item sequence with index sequence order
111+
///
112+
/// \param item_range The item sequence
113+
/// \param ind_range The index sequence
114+
///
115+
/// \note Item sequence size should be equal to index size. Otherwise behavior is undefined.
116+
/// Complexity: O(N).
117+
template<typename Range1, typename Range2>
118+
void
119+
apply_reverse_permutation(Range1& item_range, Range2& ind_range)
120+
{
121+
apply_reverse_permutation(boost::begin(item_range), boost::end(item_range),
122+
boost::begin(ind_range), boost::end(ind_range));
123+
}
124+
125+
}}
126+
#endif //BOOST_ALGORITHM_APPLY_PERMUTATION_HPP
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
/*
2+
Copyright (c) Marshall Clow 2008-2012.
3+
4+
Distributed under the Boost Software License, Version 1.0. (See accompanying
5+
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6+
7+
Revision history:
8+
27 June 2009 mtc First version
9+
23 Oct 2010 mtc Added predicate version
10+
11+
*/
12+
13+
/// \file clamp.hpp
14+
/// \brief Clamp algorithm
15+
/// \author Marshall Clow
16+
///
17+
/// Suggested by olafvdspek in https://svn.boost.org/trac/boost/ticket/3215
18+
19+
#ifndef BOOST_ALGORITHM_CLAMP_HPP
20+
#define BOOST_ALGORITHM_CLAMP_HPP
21+
22+
#include <functional> // For std::less
23+
#include <iterator> // For std::iterator_traits
24+
#include <cassert>
25+
26+
#include <boost/config.hpp>
27+
#include <boost/range/begin.hpp>
28+
#include <boost/range/end.hpp>
29+
#include <boost/mpl/identity.hpp> // for identity
30+
#include <boost/utility/enable_if.hpp> // for boost::disable_if
31+
32+
namespace boost { namespace algorithm {
33+
34+
/// \fn clamp ( T const& val,
35+
/// typename boost::mpl::identity<T>::type const & lo,
36+
/// typename boost::mpl::identity<T>::type const & hi, Pred p )
37+
/// \return the value "val" brought into the range [ lo, hi ]
38+
/// using the comparison predicate p.
39+
/// If p ( val, lo ) return lo.
40+
/// If p ( hi, val ) return hi.
41+
/// Otherwise, return the original value.
42+
///
43+
/// \param val The value to be clamped
44+
/// \param lo The lower bound of the range to be clamped to
45+
/// \param hi The upper bound of the range to be clamped to
46+
/// \param p A predicate to use to compare the values.
47+
/// p ( a, b ) returns a boolean.
48+
///
49+
template<typename T, typename Pred>
50+
BOOST_CXX14_CONSTEXPR T const & clamp ( T const& val,
51+
typename boost::mpl::identity<T>::type const & lo,
52+
typename boost::mpl::identity<T>::type const & hi, Pred p )
53+
{
54+
// assert ( !p ( hi, lo )); // Can't assert p ( lo, hi ) b/c they might be equal
55+
return p ( val, lo ) ? lo : p ( hi, val ) ? hi : val;
56+
}
57+
58+
59+
/// \fn clamp ( T const& val,
60+
/// typename boost::mpl::identity<T>::type const & lo,
61+
/// typename boost::mpl::identity<T>::type const & hi )
62+
/// \return the value "val" brought into the range [ lo, hi ].
63+
/// If the value is less than lo, return lo.
64+
/// If the value is greater than "hi", return hi.
65+
/// Otherwise, return the original value.
66+
///
67+
/// \param val The value to be clamped
68+
/// \param lo The lower bound of the range to be clamped to
69+
/// \param hi The upper bound of the range to be clamped to
70+
///
71+
template<typename T>
72+
BOOST_CXX14_CONSTEXPR T const& clamp ( const T& val,
73+
typename boost::mpl::identity<T>::type const & lo,
74+
typename boost::mpl::identity<T>::type const & hi )
75+
{
76+
return boost::algorithm::clamp ( val, lo, hi, std::less<T>());
77+
}
78+
79+
/// \fn clamp_range ( InputIterator first, InputIterator last, OutputIterator out,
80+
/// std::iterator_traits<InputIterator>::value_type const & lo,
81+
/// std::iterator_traits<InputIterator>::value_type const & hi )
82+
/// \return clamp the sequence of values [first, last) into [ lo, hi ]
83+
///
84+
/// \param first The start of the range of values
85+
/// \param last One past the end of the range of input values
86+
/// \param out An output iterator to write the clamped values into
87+
/// \param lo The lower bound of the range to be clamped to
88+
/// \param hi The upper bound of the range to be clamped to
89+
///
90+
template<typename InputIterator, typename OutputIterator>
91+
BOOST_CXX14_CONSTEXPR OutputIterator clamp_range ( InputIterator first, InputIterator last, OutputIterator out,
92+
typename std::iterator_traits<InputIterator>::value_type const & lo,
93+
typename std::iterator_traits<InputIterator>::value_type const & hi )
94+
{
95+
// this could also be written with bind and std::transform
96+
while ( first != last )
97+
*out++ = boost::algorithm::clamp ( *first++, lo, hi );
98+
return out;
99+
}
100+
101+
/// \fn clamp_range ( const Range &r, OutputIterator out,
102+
/// typename std::iterator_traits<typename boost::range_iterator<const Range>::type>::value_type const & lo,
103+
/// typename std::iterator_traits<typename boost::range_iterator<const Range>::type>::value_type const & hi )
104+
/// \return clamp the sequence of values [first, last) into [ lo, hi ]
105+
///
106+
/// \param r The range of values to be clamped
107+
/// \param out An output iterator to write the clamped values into
108+
/// \param lo The lower bound of the range to be clamped to
109+
/// \param hi The upper bound of the range to be clamped to
110+
///
111+
template<typename Range, typename OutputIterator>
112+
BOOST_CXX14_CONSTEXPR typename boost::disable_if_c<boost::is_same<Range, OutputIterator>::value, OutputIterator>::type
113+
clamp_range ( const Range &r, OutputIterator out,
114+
typename std::iterator_traits<typename boost::range_iterator<const Range>::type>::value_type const & lo,
115+
typename std::iterator_traits<typename boost::range_iterator<const Range>::type>::value_type const & hi )
116+
{
117+
return boost::algorithm::clamp_range ( boost::begin ( r ), boost::end ( r ), out, lo, hi );
118+
}
119+
120+
121+
/// \fn clamp_range ( InputIterator first, InputIterator last, OutputIterator out,
122+
/// std::iterator_traits<InputIterator>::value_type const & lo,
123+
/// std::iterator_traits<InputIterator>::value_type const & hi, Pred p )
124+
/// \return clamp the sequence of values [first, last) into [ lo, hi ]
125+
/// using the comparison predicate p.
126+
///
127+
/// \param first The start of the range of values
128+
/// \param last One past the end of the range of input values
129+
/// \param out An output iterator to write the clamped values into
130+
/// \param lo The lower bound of the range to be clamped to
131+
/// \param hi The upper bound of the range to be clamped to
132+
/// \param p A predicate to use to compare the values.
133+
/// p ( a, b ) returns a boolean.
134+
135+
///
136+
template<typename InputIterator, typename OutputIterator, typename Pred>
137+
BOOST_CXX14_CONSTEXPR OutputIterator clamp_range ( InputIterator first, InputIterator last, OutputIterator out,
138+
typename std::iterator_traits<InputIterator>::value_type const & lo,
139+
typename std::iterator_traits<InputIterator>::value_type const & hi, Pred p )
140+
{
141+
// this could also be written with bind and std::transform
142+
while ( first != last )
143+
*out++ = boost::algorithm::clamp ( *first++, lo, hi, p );
144+
return out;
145+
}
146+
147+
/// \fn clamp_range ( const Range &r, OutputIterator out,
148+
/// typename std::iterator_traits<typename boost::range_iterator<const Range>::type>::value_type const & lo,
149+
/// typename std::iterator_traits<typename boost::range_iterator<const Range>::type>::value_type const & hi,
150+
/// Pred p )
151+
/// \return clamp the sequence of values [first, last) into [ lo, hi ]
152+
/// using the comparison predicate p.
153+
///
154+
/// \param r The range of values to be clamped
155+
/// \param out An output iterator to write the clamped values into
156+
/// \param lo The lower bound of the range to be clamped to
157+
/// \param hi The upper bound of the range to be clamped to
158+
/// \param p A predicate to use to compare the values.
159+
/// p ( a, b ) returns a boolean.
160+
//
161+
// Disable this template if the first two parameters are the same type;
162+
// In that case, the user will get the two iterator version.
163+
template<typename Range, typename OutputIterator, typename Pred>
164+
BOOST_CXX14_CONSTEXPR typename boost::disable_if_c<boost::is_same<Range, OutputIterator>::value, OutputIterator>::type
165+
clamp_range ( const Range &r, OutputIterator out,
166+
typename std::iterator_traits<typename boost::range_iterator<const Range>::type>::value_type const & lo,
167+
typename std::iterator_traits<typename boost::range_iterator<const Range>::type>::value_type const & hi,
168+
Pred p )
169+
{
170+
return boost::algorithm::clamp_range ( boost::begin ( r ), boost::end ( r ), out, lo, hi, p );
171+
}
172+
173+
174+
}}
175+
176+
#endif // BOOST_ALGORITHM_CLAMP_HPP

0 commit comments

Comments
 (0)