• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Boost nil_generator.hpp header file  ----------------------------------------------//
2 
3 // Copyright 2010 Andy Tompkins.
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // https://www.boost.org/LICENSE_1_0.txt)
7 
8 #ifndef BOOST_UUID_NIL_GENERATOR_HPP
9 #define BOOST_UUID_NIL_GENERATOR_HPP
10 
11 #include <boost/uuid/uuid.hpp>
12 
13 namespace boost {
14 namespace uuids {
15 
16 // generate a nil uuid
17 struct nil_generator {
18     typedef uuid result_type;
19 
operator ()boost::uuids::nil_generator20     uuid operator()() const {
21         // initialize to all zeros
22         uuid u = {{0}};
23         return u;
24     }
25 };
26 
nil_uuid()27 inline uuid nil_uuid() {
28     return nil_generator()();
29 }
30 
31 }} // namespace boost::uuids
32 
33 #endif // BOOST_UUID_NIL_GENERATOR_HPP
34 
35