Skip to content

Instantly share code, notes, and snippets.

@jeremyroman
Last active Jun 17, 2020
Embed
What would you like to do?
class AssociatedFrobnicator : public base::SupportsUserData::Data {
public:
Frobnicator* frobnicator() const { return frobnicator_; }
void set_frobnicator(Frobnicator* frobnicator) const { frobnicator_ = frobnicator; }
private:
Frobnicator* frobnicator_;
};
base::SupportsUserData::Data* data;
static_cast<AssociatedFrobnicator*>(data)->set_frobnicator(new_frobnicator);
std::any& data;
any_cast<Frobnicator*&>(data) = new_frobnicator;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment