Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2006-05-03 00:59:59


"Robert Ramey" <ramey_at_[hidden]> writes:

> I've given a quick look at your post and attachtment.
>
> I vividly recall the making several attempts to get BOOST...EXPORT
> to compile - then to instantiate code. In fact, even those efforts
> were not entirely successful - CW still can't handle it. Then there
> was a final round getting it past two phase lookup.

Two phase lookup is a non-issue with the technique I posted, because
everything is invoked with qualification and looked up from the point
of the export, and it works beautifully with CW (both version 9.4 and
8.3), not to mention Comeau, Intel, GCC all the way back to 2.95, msvc
back to 6, and Borland.

> So as much as I would like to see this last header dependency
> eliminated, I think it would take a lot more time than it would
> first appear.

Well, this sounds really familiar to me for some reason. The fact
remains that I've proven the workability of every single element of
this solution. They are all well-understood (at least by me).

> And right now I don't have the time required even to address higher
> priority issues.

Well, that's another matter. We're all out of time, I suppose.

However, since I happen to be intimately familiar with what's required
here, I'm willing to work up a complete patch for you if you'll tell
me I won't be wasting my time. It would give me the chance to the
"instantiate arbitrary code from a class template body" abstraction
into a separate sub-library.

----
And if you don't like that idea, please allow me to offer this
simplification of your export_generator:
  namespace export_impl {
    template <class T>
    struct instantiate_archive_for
    {
        template <class A>
        void operator()(A*) const
        {
            archive<A,T>::instantiate();
        }
    };
  } // namespace export_impl
  template<class T, class ASeq>
  struct export_generator {
      export_generator(){
          boost::mpl::for_each<ASeq, add_pointer<_> >(
                export_impl::instantiate_archive_for<T>);
      }
      static const export_generator instance;
  };
The above solves no real problems for users other than slightly
improved compile times, so you really should accept my first offer ;-)
-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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