I have just started reading Modern C++ Design Generic programming and Design Patterns Applied and I am wondering if I need to go through some very basic tutorial on policy-based class design before I dive in. Will chapter 1 provide all I need to follow it?
I am already experienced with template usage (STL/boost/Poco) and writing templat...
struct InkPen
{
void Write()
{
this->WriteImplementation();
}
void WriteImplementation()
{
std::cout << "Writing using a inkpen" << std::endl;
}
};
struct BoldPen
{
void Write()
{
std::cout << "Writing using a boldpen" << std::endl;
}
};
template<class PenType>
class Writer : public PenType
{
public:
v...
Hello,
I have a class called Device that accepts two policies as far as I can see: StatePolicy and BehaviorPolicy.
The StatePolicy holds and manages the state of the device.
The BehaviorPolicy wraps the device driver that is written in C or C++.
Now I have two questions:
How to coordinate between the state and the behavior policies?
...
Hard to come up with a good title for this question. What I really need is to be able to provide template parameters with different number of arguments in place of a single parameter. Doesn't make a lot of sense so I'll go over the reason:
template < typename T, template <typename,typename> class Policy = default_policy >
struct polic...