Boost logo

Boost :

From: scleary_at_[hidden]
Date: 2001-07-20 07:12:09


> The big problem I had was the handling of default template parameters.
> Basically, I could not specify these again, so users of the forward
declaration
> library were forced to spell out all the template parameters.

You can specify them in your forward header, and not in your implementation
header. That's what I do for poolfwd.hpp:

//map_fwd.hpp
namespace std {
  template <class Key,
            class T,
            class Compare = std::less<T>,
            class Alloc = std::allocator<T> >
  class multimap;
}

//map.hpp
namespace std {
  template <class Key,
            class T,
            class Compare,
            class Alloc>
  class multimap { ... };
}

//some client .hpp file
#include "map_fwd.hpp"

class map_tester {
  //map pointer can use a forward declaration
  std::multimap<int, int> * mmapPtr_;
};

        -Steve


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