私は構造体ました:struct string memberを参照するには?
struct User {
~User();
Datacratic::Id id; ///< Exchange-specific user ID
Datacratic::Id buyeruid; ///< Exchange seat-specific user ID
Datacratic::TaggedInt yob; ///< Year of birth
std::string gender; ///< Gender: Male, Female, Other
Datacratic::CSList keywords; ///< List of keywords of consumer intent
Datacratic::UnicodeString customdata; ///< Custom data from exchange
Datacratic::Optional<Geo> geo; ///< Geolocation of user at registration
std::vector<Data> data; ///< User data segments
Json::Value ext;
}
私はuser.gender
で性別を参照すると、それは言う:コンパイラエラーから
error: âstruct Datacratic::Optional<OpenRTB::User>â has no member named âgenderâ
result->segments.addStrings("gender", result->user.gender);
おかげで、 アン
[(非常に曖昧な)ドキュメント](http://rtbkit.org/dox/0.9/structOpenRTB_1_1Optional.html)によると、Datacratic :: Optionalはポインタのように動作します。私は[このディスカッション](https://groups.google.com/a/rtbkit.org/forum/#!topic/discuss/ibmezgov214)のためにのみこれを発見しました。 'result-> user-> gender'は機能しますか? –
はい、私はユーザー構造からジェンダーを追加しようとしていますが、それは文句を言います。 @Rhymoid –
コンパイラは 'result-> segments.addStrings(" gender "、result-> user-> gender)を受け付けますか?もしそうなら、あなたはそれが動作すると期待どおりに動作しますか?そうでない場合、コンパイラは異なるエラーを出しますか? –