]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/asio/ip/address_v6_range.hpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / boost / asio / ip / address_v6_range.hpp
CommitLineData
b32b8144
FG
1//
2// ip/address_v6_range.hpp
3// ~~~~~~~~~~~~~~~~~~~~~~~
4//
f67539c2 5// Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
b32b8144
FG
6// Oliver Kowalke (oliver dot kowalke at gmail dot com)
7//
8// Distributed under the Boost Software License, Version 1.0. (See accompanying
9// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
10//
11
12#ifndef BOOST_ASIO_IP_ADDRESS_V6_RANGE_HPP
13#define BOOST_ASIO_IP_ADDRESS_V6_RANGE_HPP
14
15#if defined(_MSC_VER) && (_MSC_VER >= 1200)
16# pragma once
17#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18
19#include <boost/asio/detail/config.hpp>
20#include <boost/asio/ip/address_v6_iterator.hpp>
21
22#include <boost/asio/detail/push_options.hpp>
23
24namespace boost {
25namespace asio {
26namespace ip {
27
28template <typename> class basic_address_range;
29
30/// Represents a range of IPv6 addresses.
31/**
32 * @par Thread Safety
33 * @e Distinct @e objects: Safe.@n
34 * @e Shared @e objects: Unsafe.
35 */
36template <> class basic_address_range<address_v6>
37{
38public:
39 /// The type of an iterator that points into the range.
40 typedef basic_address_iterator<address_v6> iterator;
41
42 /// Construct an empty range.
43 basic_address_range() BOOST_ASIO_NOEXCEPT
44 : begin_(address_v6()),
45 end_(address_v6())
46 {
47 }
48
49 /// Construct an range that represents the given range of addresses.
50 explicit basic_address_range(const iterator& first,
51 const iterator& last) BOOST_ASIO_NOEXCEPT
52 : begin_(first),
53 end_(last)
54 {
55 }
56
57 /// Copy constructor.
58 basic_address_range(const basic_address_range& other) BOOST_ASIO_NOEXCEPT
59 : begin_(other.begin_),
60 end_(other.end_)
61 {
62 }
63
64#if defined(BOOST_ASIO_HAS_MOVE)
65 /// Move constructor.
66 basic_address_range(basic_address_range&& other) BOOST_ASIO_NOEXCEPT
67 : begin_(BOOST_ASIO_MOVE_CAST(iterator)(other.begin_)),
68 end_(BOOST_ASIO_MOVE_CAST(iterator)(other.end_))
69 {
70 }
71#endif // defined(BOOST_ASIO_HAS_MOVE)
72
73 /// Assignment operator.
74 basic_address_range& operator=(
75 const basic_address_range& other) BOOST_ASIO_NOEXCEPT
76 {
77 begin_ = other.begin_;
78 end_ = other.end_;
79 return *this;
80 }
81
82#if defined(BOOST_ASIO_HAS_MOVE)
83 /// Move assignment operator.
84 basic_address_range& operator=(
85 basic_address_range&& other) BOOST_ASIO_NOEXCEPT
86 {
87 begin_ = BOOST_ASIO_MOVE_CAST(iterator)(other.begin_);
88 end_ = BOOST_ASIO_MOVE_CAST(iterator)(other.end_);
89 return *this;
90 }
91#endif // defined(BOOST_ASIO_HAS_MOVE)
92
93 /// Obtain an iterator that points to the start of the range.
94 iterator begin() const BOOST_ASIO_NOEXCEPT
95 {
96 return begin_;
97 }
98
99 /// Obtain an iterator that points to the end of the range.
100 iterator end() const BOOST_ASIO_NOEXCEPT
101 {
102 return end_;
103 }
104
105 /// Determine whether the range is empty.
106 bool empty() const BOOST_ASIO_NOEXCEPT
107 {
108 return begin_ == end_;
109 }
110
111 /// Find an address in the range.
112 iterator find(const address_v6& addr) const BOOST_ASIO_NOEXCEPT
113 {
114 return addr >= *begin_ && addr < *end_ ? iterator(addr) : end_;
115 }
116
117private:
118 iterator begin_;
119 iterator end_;
120};
121
122/// Represents a range of IPv6 addresses.
123typedef basic_address_range<address_v6> address_v6_range;
124
125} // namespace ip
126} // namespace asio
127} // namespace boost
128
129#include <boost/asio/detail/pop_options.hpp>
130
131#endif // BOOST_ASIO_IP_ADDRESS_V6_RANGE_HPP