What I need:
template <class Context/*if Context has a Buffer typedef*/>
struct Buffer {
typedef typename Context::Buffer type;
};
template <class Context/*if Context doesn't have a Buffer typedef*/>
struct Buffer {
typedef std::shared_ptr<void> type;
};
If the parameter class Context has a Buffer typedef, then it's used, otherwise shared_ptr would be used.
How to write the templates? thanks in advance.
Aucun commentaire:
Enregistrer un commentaire