Eponymous
Eponymous

Reputation: 6831

C++ compile-time un-implemented check

We have several C++ functions that will be implemented in phase 2 of our project that are part of the public interface or their respective classes and modules. Because they are part of the public interface, we think they should be present, at least in the headers, during phase 1 so that we are still thinking about them as we implement the rest of the classes. However, since they are unimplemented, we want no one to call them. We would like this check to occur at compile time, to ensure correctness.

My desires are:

I am considering three options:

Is there a better way? And if not is there a reason to prefer the template or comment options over the deprecated option?

Upvotes: 4

Views: 1248

Answers (1)

Jarod42
Jarod42

Reputation: 217850

As alternative:

You can just declare them without definition, so you get link error.
You may then provide a library not_yet_implemented with empty definition to allow the premature usage of these functions.

or

Mark you method deleted: = delete, eventually by wrapping that in a macro

#define NOT_YET_IMPLEMENTED = delete

Upvotes: 3

Related Questions