utilities.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Boost.Geometry Index
  2. //
  3. // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
  4. //
  5. // This file was modified by Oracle on 2020.
  6. // Modifications copyright (c) 2020 Oracle and/or its affiliates.
  7. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  8. //
  9. // Use, modification and distribution is subject to the Boost Software License,
  10. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  11. // http://www.boost.org/LICENSE_1_0.txt)
  12. #include <type_traits>
  13. #include <boost/swap.hpp>
  14. #ifndef BOOST_GEOMETRY_INDEX_DETAIL_UTILITIES_HPP
  15. #define BOOST_GEOMETRY_INDEX_DETAIL_UTILITIES_HPP
  16. namespace boost { namespace geometry { namespace index { namespace detail {
  17. template<class T>
  18. static inline void assign_cond(T & l, T const& r, std::true_type)
  19. {
  20. l = r;
  21. }
  22. template<class T>
  23. static inline void assign_cond(T &, T const&, std::false_type) {}
  24. template<class T>
  25. static inline void move_cond(T & l, T & r, std::true_type)
  26. {
  27. l = ::boost::move(r);
  28. }
  29. template<class T>
  30. static inline void move_cond(T &, T &, std::false_type) {}
  31. template <typename T> inline
  32. void swap_cond(T & l, T & r, std::true_type)
  33. {
  34. ::boost::swap(l, r);
  35. }
  36. template <typename T> inline
  37. void swap_cond(T &, T &, std::false_type) {}
  38. }}}} // namespace boost::geometry::index::detail
  39. #endif // BOOST_GEOMETRY_INDEX_DETAIL_UTILITIES_HPP