nil_generator.hpp 751 B

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