Subject: question about dynamic_any
From: Florian Preknya <[email-masked]>
To: (Usenet)
Date: 28 Mar 2005 07:03:43 -0500
Newsgroups: comp.lang.c++.moderated

I read about dynamic_any a year ago, once with the the dynamic_any
campaign proposed by CUJ (see
http://www.cuj.com/documents/s=8470/cujweb0309nasonov). I did not see
the power of the construction that time, but nowadays I realized I need
something like dynamic_any for my current project. I don't know if it's
feasible, but my ideea was to use dynamic_any instead of template
parameters for methods that I want to keep virtual, but also permit
"generic" parameters.
So, what's the status of dynamic_any in the boost corner? It's in
proposal form, or it was removed (because it is covered by other
libraries), etc. ? I saw that the dynamic_any project is on hold, I
think was never compiled on Windows systems. Also, it generates an
INTERNAL_COMPILER_ERROR on VC7.1. (I can give further details if
needed). Also, the dynamic_any version I take from sourceforge rely on
an older version of boost and I had to modify some include paths.

Or, is another trick for my problem that can be done without
dynamic_any? (see a simplified sample)

// what I want, but not possible
// Note that I don't want to make the Factory class a template class!!
class AKindOfFactory
{
     template <class Iterator>
      virtual boost::shared_ptr<NewObject> create(Iterator start,
Iterator end) = 0;
};

// can be redesigned with dynamic_any like this

typedef dynamic_any::any<mpl::list<dynamic_any::dereference,
dynamic_any::increment> > any_iterator;

class AKindOfFactory
{
      virtual boost::shared_ptr<NewObject> create(any_iterator start,
any_iterator end) = 0;
};

Thanks,
Florian Preknya

      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]