|
Boost Users : |
From: Doug Henry (brilligent_at_[hidden])
Date: 2005-11-14 16:43:47
I have been attempting to hide the boost interface when using the boost
smart pointers. I basically want to get rid of boost declarations in my
API's. This basically involves typedef-ing template classes, and the best
solution I have been able to come up with is:
template <typename T>
struct pointer
{
typedef boost::scoped_ptr<T> obj;
typedef boost::scoped_array<T> arr;
typedef boost::shared_ptr<T> sobj;
typedef boost::shared_array<T> sarr;
};
so I can do things like pointer<int>::arr var(new int[10]). This works fine,
but if I try to get tricky it falls apart. Another example:
template <typename T>
class Stuff
{
private:
pointer<T>::arr some_stuff;
};
This does not work (I can't even start to tell you why), but I have hit the
point where I have to start second guessing my approach to this problem. Are
there other (possibly terrible) tricks to get around the typedef templates
problem? Any input will probably help.
-thanks
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