summaryrefslogtreecommitdiffstats
path: root/contrib/src/boost/uuid/detail/uuid_generic.hpp
blob: f6c386054fc32573fa7989155d1e06f0b7deaf19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*

 *             Copyright Andy Tompkins 2006.

 * Distributed under the Boost Software License, Version 1.0.

 *    (See accompanying file LICENSE_1_0.txt or copy at

 *          http://www.boost.org/LICENSE_1_0.txt)

 */
/*!

 * \file   uuid/detail/uuid_generic.hpp

 *

 * \brief  This header contains generic implementation of \c boost::uuid operations.

 */

#ifndef BOOST_UUID_DETAIL_UUID_GENERIC_HPP_INCLUDED_

#define BOOST_UUID_DETAIL_UUID_GENERIC_HPP_INCLUDED_


#include <string.h>


namespace boost {
namespace uuids {

inline bool uuid::is_nil() const BOOST_NOEXCEPT
{
    for (std::size_t i = 0; i < sizeof(data); ++i)
    {
        if (data[i] != 0U)
            return false;
    }
    return true;
}

inline void uuid::swap(uuid& rhs) BOOST_NOEXCEPT
{
    uuid tmp = *this;
    *this = rhs;
    rhs = tmp;
}

inline bool operator== (uuid const& lhs, uuid const& rhs) BOOST_NOEXCEPT
{
    return memcmp(lhs.data, rhs.data, sizeof(lhs.data)) == 0;
}

inline bool operator< (uuid const& lhs, uuid const& rhs) BOOST_NOEXCEPT
{
    return memcmp(lhs.data, rhs.data, sizeof(lhs.data)) < 0;
}

} // namespace uuids

} // namespace boost


#endif // BOOST_UUID_DETAIL_UUID_GENERIC_HPP_INCLUDED_