Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-03-04 17:22:41


Jonathan Turkanis wrote:

> Is the following definition of IBar so complex that it would be
> pointless to offer it as an alternative?
>
> template< typename Derived,
> typename Base,
> typename Flags >
> struct ibar_impl {
> struct type : Base {
> struct interface_metadata : metadata_base<Derived, Base,
> Flags> { const char* names = { "foo", "foo" };
> typedef mpl::vector<
> void(const char*),
> int(int, int)
> > signatures;
> };
> void foo(const char* name)
> {
> return invoker<interface_metadata, 1>::execute(this,
> name); }
>
> int foo(int n, int m)
> {
> return invoker<interface_metadata, 2>::execute(this,
> int, int); }
> };
> };

I simplified it a bit:

   template< typename Derived,
             typename Base,
             typename Flags >
   struct ibar_impl {
        struct type : Base {
            struct interface_metadata : metadata_base<Derived, Base, Flags> {
                const char* names = { "foo", "foo" };
                typedef mpl::vector<
                            void(const char*),
                            int(int, int)
> signatures;
            };
            void foo(const char* name) { return execute<1>(this, name); }
            int foo(int n, int m) { return execute<2>(this, int, int); }
        };
   };

   typedef interface< ibar_impl<_, _, _> > IBar;

Jonathan


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