|
Boost Users : |
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2006-10-17 12:54:35
Just take a look at boost::variant data structure.
It allows you to store _one_ of enumerated types in the container. If you try to put some not
registered type instance into it you will get a compiler error. I think this data structure is
pretty cool.
What if such a variant<types 1...n> represents a communication protocol which can contain one of
enumerated message type instance. In this case the sender can not put there a message
(per-compiler) which should not be there (not allowed). And a receiver can be 100% sure that it
will not receive a message which should not be handled.
With Kind Regards,
Ovanes Markarian
On Tue, October 17, 2006 04:49, Terry G wrote:
> I've just finished reading C++ Template Metaprogramming again.
> I just don't get it.
>
> Why would someone use a type container?
>
> I have used enable_if, along with some of the logic functions for managing
> an overload set.
> Otherwise, I'm clueless.
>
> I'd really like a reference to an MPL primer or some case studies.
>
> Too much pain with very little gain. Time to ask for help.
> Rereading this, it sounds negative.
> Really, I think the MPL is really cool!
>
> terry
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net