rectangle_traits.hpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. Copyright 2008 Intel Corporation
  3. Use, modification and distribution are subject to the Boost Software License,
  4. Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt).
  6. */
  7. #ifndef BOOST_POLYGON_RECTANGLE_TRAITS_HPP
  8. #define BOOST_POLYGON_RECTANGLE_TRAITS_HPP
  9. namespace boost { namespace polygon{
  10. template <typename T, typename enable = gtl_yes>
  11. struct rectangle_traits {};
  12. template <typename T>
  13. struct rectangle_traits<T, gtl_no> {};
  14. template <typename T>
  15. struct rectangle_traits<T, typename gtl_same_type<typename T::interval_type, typename T::interval_type>::type> {
  16. typedef typename T::coordinate_type coordinate_type;
  17. typedef typename T::interval_type interval_type;
  18. static inline interval_type get(const T& rectangle, orientation_2d orient) {
  19. return rectangle.get(orient); }
  20. };
  21. template <typename T>
  22. struct rectangle_mutable_traits {
  23. template <typename T2>
  24. static inline void set(T& rectangle, orientation_2d orient, const T2& interval) {
  25. rectangle.set(orient, interval); }
  26. template <typename T2, typename T3>
  27. static inline T construct(const T2& interval_horizontal,
  28. const T3& interval_vertical) {
  29. return T(interval_horizontal, interval_vertical); }
  30. };
  31. }
  32. }
  33. #endif