lo tolmencre
lo tolmencre

Reputation: 3954

variable return type in function that returns held object of boost::any

Say I have a class C with a field of type std::vector<boost::any>. I have index operator const boost::any C::operator[](const size_t i); but what if I wanted C::operator[](const size_t i) to return the object held by the any object at index i rather than the any-object itself? The function would need a variable return type... which is not possible. Is there some way by for example means of indirection to achieve this anyway?

Upvotes: 1

Views: 114

Answers (0)

Related Questions