--- a/src/mlpack/core/cv/meta_info_extractor.hpp +++ b/src/mlpack/core/cv/meta_info_extractor.hpp @@ -38,50 +38,142 @@ bool NumClasses> struct TrainForm; -template -struct TrainFormBase -{ - using PredictionsType = PT; - using WeightsType = WT; - - /* A minimum number of parameters that should be inferred */ - static const size_t MinNumberOfAdditionalArgs = 1; - - template - using Type = RT(Class::*)(SignatureParams..., Ts...); -}; - -template -struct TrainForm : public TrainFormBase {}; - -template -struct TrainForm : public TrainFormBase {}; - -template -struct TrainForm : public TrainFormBase {}; - -template -struct TrainForm : public TrainFormBase {}; - -template -struct TrainForm : public TrainFormBase {}; - -template -struct TrainForm : public TrainFormBase {}; - -template -struct TrainForm : public TrainFormBase {}; - -template -struct TrainForm : public TrainFormBase {}; +#if _MSC_VER <= 1916 // Visual Studio 2017 version 15.9 or older. + // Due to an internal MSVC compiler bug (MSVC ) we can't use two parameter + // packs. So we have to write multiple TrainFormBase forms. + template + struct TrainFormBase4 + { + using PredictionsType = PT; + using WeightsType = WT; + + /* A minimum number of parameters that should be inferred */ + static const size_t MinNumberOfAdditionalArgs = 1; + + template + using Type = RT(Class::*)(T1, T2, Ts...); + }; + + template + struct TrainFormBase5 + { + using PredictionsType = PT; + using WeightsType = WT; + + /* A minimum number of parameters that should be inferred */ + static const size_t MinNumberOfAdditionalArgs = 1; + + template + using Type = RT(Class::*)(T1, T2, T3, Ts...); + }; + + template + struct TrainFormBase6 + { + using PredictionsType = PT; + using WeightsType = WT; + + /* A minimum number of parameters that should be inferred */ + static const size_t MinNumberOfAdditionalArgs = 1; + + template + using Type = RT(Class::*)(T1, T2, T3, T4, Ts...); + }; + + template + struct TrainFormBase7 + { + using PredictionsType = PT; + using WeightsType = WT; + + /* A minimum number of parameters that should be inferred */ + static const size_t MinNumberOfAdditionalArgs = 1; + + template + using Type = RT(Class::*)(T1, T2, T3, T4, T5, Ts...); + }; + + template + struct TrainForm : public TrainFormBase4 {}; + + template + struct TrainForm : public TrainFormBase5 {}; + + template + struct TrainForm : public TrainFormBase5 {}; + + template + struct TrainForm : public TrainFormBase6 {}; + + template + struct TrainForm : public TrainFormBase5 {}; + + template + struct TrainForm : public TrainFormBase6 {}; + + template + struct TrainForm : public TrainFormBase6 {}; + + template + struct TrainForm : public TrainFormBase7 {}; +#else + template + struct TrainFormBase + { + using PredictionsType = PT; + using WeightsType = WT; + + /* A minimum number of parameters that should be inferred */ + static const size_t MinNumberOfAdditionalArgs = 1; + + template + using Type = RT(Class::*)(SignatureParams..., Ts...); + }; + + template + struct TrainForm : public TrainFormBase {}; + + template + struct TrainForm : public TrainFormBase {}; + + template + struct TrainForm : public TrainFormBase {}; + + template + struct TrainForm : public TrainFormBase {}; + + template + struct TrainForm : public TrainFormBase {}; + + template + struct TrainForm : public TrainFormBase {}; + + template + struct TrainForm : public TrainFormBase {}; + + template + struct TrainForm : public TrainFormBase {}; +#endif /* A struct for indication that a right method form can't be found */ struct NotFoundMethodForm