GreycLab / CImg

The CImg Library is a small and open-source C++ toolkit for image processing
http://cimg.eu
Other
1.46k stars 278 forks source link

Explicit instantiation bug of `CImgList` #402

Closed NeumoNeumo closed 8 months ago

NeumoNeumo commented 8 months ago

When I try to instantiate CImgList in the latest commit like this

#include "CImg.h"
template struct cimg_library::CImgList<unsigned char>;

What I get from the compiler is

In file included from b.cpp:1:                                                                
./CImg.h:65161:29: error: cannot cast from type 'CImg<unsigned char>' to pointer type 'char *'
        CImg<charT>::string((char*)_data[l]).move_to(str);                                    
                            ^~~~~~~~~~~~~~~                                                   
b.cpp:3:31: note: in instantiation of member function 'cimg_library::CImgList<unsigned char>::
__display' requested here                                                                     
template struct cimg_library::CImgList<unsigned char>;                                        
                              ^                                                               
1 error generated.                                                                            

Perhaps what you want in CImg.h is

CImg<charT>::string((char*)(_data[l]._data)).move_to(str);     
dtschump commented 8 months ago

That's it, yes, thanks for reporting!