Boost logo

Boost Users :

From: Hicham Mouline (hicham_at_[hidden])
Date: 2008-01-24 02:47:27


I omited to show the definition of those templates TreeImplBase.They
would have the map as a private member,as protected members, functions to
insert instances in the map, called by the ctors of derived templates.

I will look at boost::fusion thanks,

  ----- Original Message -----
  From: "Ovanes Markarian"
  To: boost-users_at_[hidden]
  Subject: Re: [Boost-users] Multiple templates singletons
  Date: Thu, 24 Jan 2008 00:02:01 +0100

  Hello!

  I have a question to this construct:

    template <typename contractType, typename treeType>
    class TreeImplBase;

    Each specialization of these holds a
    static std::map< boost::tuple<int,enum1,enum2,enum3>, const
    TreeImplBase* >;
    which contains the list of the derived template classes.

  How can you instantiate a pointer to the class temlate? Class
  template is an incomplete type. You will not be able to specify a
  pointer to it.

  I think you should use boost::fusion inplace. This lib, offers a
  compile time map (if you map the same time to an instance of it, use
  a fusion set), which can map a type to an instance. This is what you
  need.

  http://spirit.sourceforge.net/dl_more/fusion_v2/libs/fusion/doc/html/fusion/sequences/containers/map.html
  http://spirit.sourceforge.net/dl_more/fusion_v2/libs/fusion/doc/html/fusion/sequences/containers/set.html

    Any comments are appreciated,

    Perhaps this is a known design pattern,
    perhaps there is an easier way of doing this,
    perhaps there is a boost library which helps with this,

  Good Luck,
  Ovanes

  _______________________________________________
  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