I have a Builder class which has a number of set methods (with various names and arguments). I need to allow up to 4 of these methods to be called, and no more. I can obviously generate a run-time error if more than 4 set functions are called, but I want to generate a compiler error instead. This would be a programming error, and I would like the opportunity to fix it (decide which 4 calls I want to keep) and not wait until it fails while running (in which case I would have to do something arbitrary like ignore the fifth one). I need a solution which uses standard C++, but not new C++11 features. Below is an example of 5 calls (which should generate a compiler error on the fifth).
Builder builder();
builder.setA(1);
builder.setB(1.3);
builder.setC("sss");
builder.setD(0);
builder.setE(3, "aaa");