On August 2, 2015 8:41:08 PM EDT, Gavin Lambert
On 2/08/2015 20:05, Will Hall wrote:
struct A { static string value; };
struct B : public A { static string value; };
string A::value("A"); string B::value("B");
While I can't answer your question directly, I can tell you that this is bad coding practice in C++. Usually it stems from a misunderstanding, while other times it's just a bad design.
Have you considered type traits. Don't know how that works with python though. template<class T> struct policy { static const bool value = false; }; struct policy<A> { static const bool value = true; }; There's an interesting tutorial here: http://www.cantrip.org/traits.html
So, to summarise, any idea how to provide polymorphic Python class variables in boost::python?
Static/class fields cannot be polymorphic, by definition.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Sent from my Android device with K-9 Mail. Please excuse my brevity.