Hi,
I wondered if there are any examples of a templated handle class
within the boost code base I could look at?
I'm trying to hide both the implementation of the body class and that
of the template type, something like that below but my compiler is
complaining about partial specialization in the declaration of the
implementation class in handle.cpp
I know its not strictly boost related, but I don't get any of the
comp.lang.* groups.
Also before anybody suggests I should be using a smart pointer for the
impl variable I'd like to avoid having to introduce the boost library
to the user of the two .h files.
My goal was that the users would only need the *.h files and I could
provide fred.o fred2.o fred3.o etc. as new options for "fred" come
along.
I know that using the template doesn't appear to be getting me
anywhere towads my original goal (generally needing the implementation
to get the templated code to work!) but I'd like to see if I could at
least get the code to compile by studying anything similar as it may
have some use in other areas.
Thanks
Kevin
// -------------- fred.h
class fred
{
public:
void somefunction();
};
// -------------- handle.h
template <typename T>
class handle
{
public:
handle();
~handle();
void callsomefunctionviaimpl();
private:
template <typename U> class handleimpl;
handleimpl<T> *impl;
};
// -------------- fred.cpp
#include <iostream>
using namespace std;
#include "fred.h"
void fred::somefunction()
{
cout << "fred::somefunction()" << endl;
}
// -------------- handle.cpp
#include <iostream>
using namespace std;
#include "handle.h"
template