I am trying to initialize a new member variable in a struct and use it elsewhere,
This is the struct
struct Subscription
{
const eprosima::xtypes::DynamicType *type;
soss::TopicSubscriberSystem::SubscriptionCallback callback;
};
Subscription subscription{&message_type, callback, fields};
And I was told to,
"You will need to update the definition of the Subscription struct to match the way we are trying to initialize it there for the fields "
I hovered over the fields variable in the code which was inside a for loop elsewhere, then vscode told me the type is
std::map<std::string, std::string> fields
so that tells me the type of the new member variable I need to add to the Subscription struct
Just not sure what to add on the struct tho, any idea
Maybe I'm missing something here but did this occur to you?
struct Subscription
{
const eprosima::xtypes::DynamicType *type;
soss::TopicSubscriberSystem::SubscriptionCallback callback;
std::map<std::string, std::string> fields;
};
That seems to be what you are being asked to do.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.