]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/uuid/include/boost/uuid/detail/uuid_generic.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / uuid / include / boost / uuid / detail / uuid_generic.hpp
1 /*
2 * Copyright Andy Tompkins 2006.
3 * Distributed under the Boost Software License, Version 1.0.
4 * (See accompanying file LICENSE_1_0.txt or copy at
5 * http://www.boost.org/LICENSE_1_0.txt)
6 */
7 /*!
8 * \file uuid/detail/uuid_generic.hpp
9 *
10 * \brief This header contains generic implementation of \c boost::uuid operations.
11 */
12
13 #ifndef BOOST_UUID_DETAIL_UUID_GENERIC_HPP_INCLUDED_
14 #define BOOST_UUID_DETAIL_UUID_GENERIC_HPP_INCLUDED_
15
16 #include <string.h>
17
18 namespace boost {
19 namespace uuids {
20
21 inline bool uuid::is_nil() const BOOST_NOEXCEPT
22 {
23 for (std::size_t i = 0; i < sizeof(data); ++i)
24 {
25 if (data[i] != 0U)
26 return false;
27 }
28 return true;
29 }
30
31 inline void uuid::swap(uuid& rhs) BOOST_NOEXCEPT
32 {
33 uuid tmp = *this;
34 *this = rhs;
35 rhs = tmp;
36 }
37
38 inline bool operator== (uuid const& lhs, uuid const& rhs) BOOST_NOEXCEPT
39 {
40 return memcmp(lhs.data, rhs.data, sizeof(lhs.data)) == 0;
41 }
42
43 inline bool operator< (uuid const& lhs, uuid const& rhs) BOOST_NOEXCEPT
44 {
45 return memcmp(lhs.data, rhs.data, sizeof(lhs.data)) < 0;
46 }
47
48 } // namespace uuids
49 } // namespace boost
50
51 #endif // BOOST_UUID_DETAIL_UUID_GENERIC_HPP_INCLUDED_