Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / gil / test / core / color / concepts.cpp
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/device_n.hpp>
17 #include <boost/gil/gray.hpp>
18 #include <boost/gil/rgb.hpp>
19 #include <boost/gil/rgba.hpp>
20 #include <boost/gil/cmyk.hpp>
21
22 #include <boost/concept_check.hpp>
23
24 namespace gil = boost::gil;
25 using boost::function_requires;
26
27 int main()
28 {
29     // TODO: Most constraints() for color concepts are no-op as not implemented.
30     //       Once implemented, this test should help to catch any issues early.
31
32     function_requires<gil::ColorSpaceConcept<gil::devicen_t<2>>>();
33     function_requires<gil::ColorSpaceConcept<gil::devicen_t<3>>>();
34     function_requires<gil::ColorSpaceConcept<gil::devicen_t<4>>>();
35     function_requires<gil::ColorSpaceConcept<gil::devicen_t<5>>>();
36     function_requires<gil::ColorSpaceConcept<gil::gray_t>>();
37     function_requires<gil::ColorSpaceConcept<gil::cmyk_t>>();
38     function_requires<gil::ColorSpaceConcept<gil::rgb_t>>();
39     function_requires<gil::ColorSpaceConcept<gil::rgba_t>>();
40
41     function_requires<gil::ColorSpacesCompatibleConcept<gil::gray_t, gil::gray_t>>();
42     function_requires<gil::ColorSpacesCompatibleConcept<gil::cmyk_t, gil::cmyk_t>>();
43     function_requires<gil::ColorSpacesCompatibleConcept<gil::rgb_t, gil::rgb_t>>();
44     function_requires<gil::ColorSpacesCompatibleConcept<gil::rgba_t, gil::rgba_t>>();
45     function_requires<gil::ColorSpacesCompatibleConcept
46         <
47             gil::devicen_t<2>,
48             gil::devicen_t<2>
49         >>();
50 }