utilities.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Boost.Geometry Index
  2. //
  3. // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
  4. //
  5. // Use, modification and distribution is subject to the Boost Software License,
  6. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. #include <boost/swap.hpp>
  9. //#include <boost/type_traits/is_empty.hpp>
  10. #ifndef BOOST_GEOMETRY_INDEX_DETAIL_UTILITIES_HPP
  11. #define BOOST_GEOMETRY_INDEX_DETAIL_UTILITIES_HPP
  12. namespace boost { namespace geometry { namespace index { namespace detail {
  13. template<class T>
  14. static inline void assign_cond(T & l, T const& r, boost::mpl::bool_<true> const&)
  15. {
  16. l = r;
  17. }
  18. template<class T>
  19. static inline void assign_cond(T &, T const&, boost::mpl::bool_<false> const&) {}
  20. template<class T>
  21. static inline void move_cond(T & l, T & r, boost::mpl::bool_<true> const&)
  22. {
  23. l = ::boost::move(r);
  24. }
  25. template<class T>
  26. static inline void move_cond(T &, T &, boost::mpl::bool_<false> const&) {}
  27. template <typename T> inline
  28. void swap_cond(T & l, T & r, boost::mpl::bool_<true> const&)
  29. {
  30. ::boost::swap(l, r);
  31. }
  32. template <typename T> inline
  33. void swap_cond(T &, T &, boost::mpl::bool_<false> const&) {}
  34. }}}} // namespace boost::geometry::index::detail
  35. #endif // BOOST_GEOMETRY_INDEX_DETAIL_UTILITIES_HPP