I have some software that I inherited that compiles on GCC 4.8 and 7.1, and I have been able to make the modifications to make it compile on Cygwin (because I couldn't make it work on MSVS 2017). It reads:
run_filter_multi<0,1>( {}, {output}, [&]( helper::ARRC<0> const & src, helper::ARWC<1> const & dst ) { algorithm(dst[0]); }, loop_planes, loop_width, columns );
run_filter_multi is a templated function:
template< int SRCN, int DSTN, typename ALGORITHM > void run_filter_multi( helper::ARRC<SRCN> inputs, helper::ARWC<DSTN> outputs, ALGORITHM const & algorithm, bool loop_planes=true, bool loop_width=true, int columns=1 )
and helper::ARRC and helper::ARWC are:
template< int N > using ARRC = std::array<RRC,N>; template< int N > using ARWC = std::array<RWC,N>;
Basically, MSVS2017 gives me a error C2664 - it can't convert the {} parameter to a std::array< RRC,0 >. It won't let me make a 0 sized array.
My question is: is this an MSVS compiler bug, or is it something that GCC allows but shouldn't? Or is it something that -std=c++11 (which is what I am compiling to) allows, but later versions do not? It makes sense to me that std::array var = {} should work and that if you pass an empty initializer to a function expecting a std::array< class, N > that it would create an empty array, but obviously MS and everyone else do things differently.
Thanks for any info!
Aucun commentaire:
Enregistrer un commentaire