Boost logo

Boost Users :

Subject: [Boost-users] [Gil] Unknown compilation error (VS10)
From: Sapp, Mark (Mark.Sapp_at_[hidden])
Date: 2011-11-07 13:12:57


Hi all,

I have encountered a compilation error in Visual Studio 2010 that I can't find any information online about. The error is:

        error C2338: (is_same<typename Layout::color_space_t, gray_t>::value)

It occurs when I call transform_pixels (..) on image views that are not grayscale. Below is example code that reproduces the error and I have attached the build output. If you comment out the first absolute difference call, the program compiles as expected. Also, if it helps, I was able to get similar code working intermittently by commenting the line and rebuilding, then un-commenting and building (not rebuilding). That made me think it may be something related to the template definitions during compile time and the previous build results effecting something.

#include "stdafx.h"
#include <boost/gil/image.hpp>
#include <boost/gil/typedefs.hpp>

using namespace boost::gil;

template <typename Out>
struct op_absoluteDifference {
        template <typename T> Out operator()(const T& in1, const T& in2) const {
                return Out(abs(in2-in1));
        }
};

template <typename SrcView1, typename SrcView2, typename DstView>
void absoluteDifference(const SrcView1& src1, const SrcView2& src2, const DstView& dst)
{
        typedef typename channel_type<DstView>::type dst_channel_t;
        transform_pixels(src1, src2, dst, op_absoluteDifference<dst_channel_t>());
}

int _tmain(int argc, _TCHAR* argv[])
{
        rgb8_image_t img1(100,100);
        fill_pixels(view(img1), rgb8_pixel_t(0,0,0));
        rgb8_image_t img2(100,100);
        fill_pixels(view(img2), rgb8_pixel_t(10,20,30));
        rgb8_image_t img3(100,100);
            fill_pixels(view(img3), rgb8_pixel_t(0,0,0));
        absoluteDifference(const_view(img1), const_view(img2), view(img3)); //causes compilation error C2338: (is_same<typename Layout::color_space_t, gray_t>::value)
        gray16_image_t img4(100,100);
        fill_pixels(view(img4), gray16_pixel_t(0));
        gray16_image_t img5(100,100);
        fill_pixels(view(img5), gray16_pixel_t(10));
        gray16_image_t img6(100,100);
        fill_pixels(view(img6), gray16_pixel_t(0));
        absoluteDifference(const_view(img4), const_view(img5), view(img6));
        return 0;
}

I'm very new to the library so I wouldn't be surprised if I was doing something incorrectly. I appreciate any help or guidance.

Thank you for your time,
Mark

Mark Sapp
Aeroflex
O: 512-327-4401 x278
F:  512-327-3341
mark.sapp_at_[hidden]
www.aeroflex.com

Notice: This e-mail is intended solely for use of the individual or entity to which it is
addressed and may contain information that is proprietary, privileged, company confidential
and/or exempt from disclosure under applicable law. If the reader is not the intended
recipient or agent responsible for delivering the message to the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this communication is
strictly prohibited. If this communication has been transmitted from a U.S. location it may
also contain data subject to the International Traffic in Arms Regulations or U.S. Export
Administration Regulations and cannot be disseminated, distributed or copied to foreign
nationals, residing in the U.S. or abroad, without the prior approval of the U.S. Department
of State or appropriate export licensing authority. If you have received this communication
in error, please notify the sender by reply e-mail or collect telephone call and delete or
destroy all copies of this e-mail message, any physical copies made of this e-mail message
and/or any file attachment(s).




Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net