次のコードに対して警告が表示されますが、バリアントから boost::blank を削除すると消えます。
namespace DB
{
struct Value{};
struct Container{};
}
typedef boost::variant <boost::blank, DB::Value, DB::Container> CommandData;
struct Command {
explicit Command(CommandData& _data): data(_data){
}
CommandData data;
};
int main()
{
CommandData commandData;
Command command(commandData);
return 0;
}
この問題は何ですか?
警告は次のとおりです。
1>: warning C4345: behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized
1> c:\boost_1_49_0\boost\variant\variant.hpp(1224) : while compiling class template member function 'boost::variant<T0_,T1,T2>::variant(void)'
1> with
1> [
1> T0_=boost::blank,
1> T1=DB::Value,
1> T2=DB::Container
1> ]
1> c:\code.h(38) : see reference to class template instantiation 'boost::variant<T0_,T1,T2>' being compiled
1> with
1> [
1> T0_=boost::blank,
1> T1=DB::Value,
1> T2=DB::Container
1> ]