Imported Upstream version 1.72.0
[platform/upstream/boost.git] / boost / gil / extension / toolbox / metafunctions / get_pixel_type.hpp
1 //
2 // Copyright 2012 Christian Henning, Andreas Pokorny, Lubomir Bourdev
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 #ifndef BOOST_GIL_EXTENSION_TOOLBOX_METAFUNCTIONS_GET_PIXEL_TYPE_HPP
9 #define BOOST_GIL_EXTENSION_TOOLBOX_METAFUNCTIONS_GET_PIXEL_TYPE_HPP
10
11 #include <boost/gil/extension/toolbox/dynamic_images.hpp>
12 #include <boost/gil/extension/toolbox/metafunctions/is_bit_aligned.hpp>
13
14 #include <boost/gil/detail/mp11.hpp>
15
16 namespace boost{ namespace gil {
17
18 /// get_pixel_type metafunction
19 /// \brief Depending on Image this function generates either
20 ///        the pixel type or the reference type in case
21 ///        the image is bit_aligned.
22 template<typename View>
23 struct get_pixel_type
24 {
25     using type = mp11::mp_if
26         <
27             is_bit_aligned<typename View::value_type>,
28             typename View::reference,
29             typename View::value_type
30         >;
31 };
32
33 template<typename Views>
34 struct get_pixel_type<any_image_view<Views>>
35 {
36     using type = any_image_pixel_t;
37 };
38
39 }} // namespace boost::gil
40
41 #endif