concepts.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // Copyright 2019 Mateusz Loskot <mateusz at loskot dot net>
  3. //
  4. // Distributed under the Boost Software License, Version 1.0
  5. // See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt
  7. //
  8. // FIXME: Avoid Clang's flooding of non-disableable warnings like:
  9. // "T does not declare any constructor to initialize its non-modifiable members"
  10. // when compiling with concepts check enabled.
  11. // See https://bugs.llvm.org/show_bug.cgi?id=41759
  12. #if !defined(BOOST_GIL_USE_CONCEPT_CHECK) && !defined(__clang__)
  13. #error Compile with BOOST_GIL_USE_CONCEPT_CHECK defined
  14. #endif
  15. #include <boost/gil/concepts.hpp>
  16. #include <boost/gil/color_base.hpp>
  17. #include <boost/gil/typedefs.hpp>
  18. #include <boost/concept_check.hpp>
  19. namespace gil = boost::gil;
  20. using boost::function_requires;
  21. int main()
  22. {
  23. function_requires<gil::ColorBaseConcept
  24. <
  25. gil::detail::homogeneous_color_base<std::uint8_t, gil::gray_layout_t, 1>
  26. >>();
  27. function_requires<gil::HomogeneousColorBaseConcept
  28. <
  29. gil::detail::homogeneous_color_base<std::uint8_t, gil::gray_layout_t, 1>
  30. >>();
  31. function_requires<gil::HomogeneousColorBaseValueConcept
  32. <
  33. gil::detail::homogeneous_color_base<std::uint8_t, gil::gray_layout_t, 1>
  34. >>();
  35. // FIXME: https://github.com/boostorg/gil/issues/271
  36. //function_requires
  37. //<
  38. // gil::ColorBaseConcept
  39. // <
  40. // gil::detail::homogeneous_color_base<std::uint8_t, gil::rgb_layout_t, 3>
  41. // >
  42. //>();
  43. function_requires<gil::ColorBaseConcept<gil::gray8_pixel_t>>();
  44. function_requires<gil::ColorBaseConcept<gil::rgb8_pixel_t>>();
  45. function_requires<gil::ColorBaseConcept<gil::bgr8_pixel_t>>();
  46. }