Imported Upstream version 1.72.0
[platform/upstream/boost.git] / boost / multiprecision / detail / constexpr.hpp
1 ///////////////////////////////////////////////////////////////
2 //  Copyright 2019 John Maddock. Distributed under the Boost
3 //  Software License, Version 1.0. (See accompanying file
4 //  LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
5
6 #ifndef BOOST_MP_CONSTEXPR_HPP
7 #define BOOST_MP_CONSTEXPR_HPP
8
9 #include <boost/config.hpp>
10
11 namespace boost {
12
13 namespace multiprecision {
14
15 namespace std_constexpr {
16
17 template <class T>
18 inline BOOST_CXX14_CONSTEXPR void swap(T& a, T& b)
19 {
20    T t(a);
21    a = b;
22    b = t;
23 }
24
25 template <class InputIterator, class OutputIterator>
26 inline BOOST_CXX14_CONSTEXPR OutputIterator copy(InputIterator first, InputIterator last, OutputIterator result)
27 {
28    while (first != last)
29    {
30       *result = *first;
31       ++first;
32       ++result;
33    }
34    return result;
35 }
36
37 template <class I>
38 inline BOOST_CXX14_CONSTEXPR bool equal(const I* first, const I* last, const I* other)
39 {
40    while (first != last)
41    {
42       if (*first != *other)
43          return false;
44       ++first;
45       ++other;
46    }
47    return true;
48 }
49
50 }
51
52 }
53
54 } // namespace boost::multiprecision::std_constexpr
55
56 #endif