Boost logo

Boost :

From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2006-08-05 16:12:16


Steven Watanabe wrote:
> How do you detect the end of the entries?

http://tinyurl.com/omttl

IIRC VC7/VC8 could not compile it. Even if I specified max id manually,
I could not compile the library. I stoped development because of this :(

> I can't think of anything better in general but here are
> some other possibilities that might be more convenient:
>
> struct plus : function<plus, anyT (anyT const&, anyT const&)>
> {
> typedef boost::mpl::vector<
> int (int, int),
> double (double, int),
> //...
> string (string const&, char),
> //...
> > entry_functions;
>
> template<class T, class U>
> T entry(T t, U u) const;
> };

It's limited to 50 entries in default boost configuration.

> or this:
>
> struct plus : function<plus, anyT (anyT const&, anyT const&)>
> {
> typedef boost::mpl::vector<int, double, string const&>
>first_any_argument_types;
> typedef boost::mpl::vector<int, char> second_any_argument_types;
>
> template<class T, class U>
> T entry(T t, U u) const;
> };
>
> Of course this one only works when you want every
> possible combination of the types.

Lets not forget that it's not a variant type. There should a possibility
to add default handler.

> In any case I agree that there should be a backup to use if
> the types passed in don't match one of the signatures provided.
> Maybe something like allowing any one of the arguments
> to be unbounded.

I like the idea of unbound agrument.

We explored several approaches. It makes sense not to tie to one
base class. I'll try to find time to think about it.

-- 
Alexander Nasonov
Project Manager at Akmosoft ( http://www.akmosoft.com )
Blog: http://nasonov.blogspot.com
Email: $(FirstName) dot $(LastName) at gmail dot com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk