AnyPtrとxtal::undefinedの比較
バージョンはXtal Unofficial Wikiのr429です.
Xtalスクリプトで定義したbooleanの値を取得しようとした所,undefinedと==が成り立っちゃいました.
// .xtal bool_true : true; bool_false : false; // .cpp const xtal::CodePtr& code = load_and_call(the_file); const auto& bool_true = code->member(Xid(bool_true)); const auto& bool_false = code->member(Xid(bool_false)); assert(bool_true != xtal::undefined); // こっちは期待通り assert(bool_false == xtal::undefined); // あれ? // 解決策? assert(!xtal::is_undefined(bool_true)); assert(!xtal::is_undefined(bool_false)); // パーペキ
てっきりoperator==で良いのかと思ってましたが,ダメなんですね.
ソースコードを読んでたらxtal::is_undefined(...);というのを発見.
これを使ったら期待通り動いてくれました.