1.

How A Macro Differs From A Template?

Answer»

A macro defines the meaning for an identifier.The preprocessor replaces macro in the form of strings in the source code with values DERIVED from the macro definition.The most common usage for macros defines a GLOBAL symbol that represents a VALUE. A macro cannot call itself.

On the contrary, a template allows you to create generic FUNCTIONS that admit any data type as parameters and return a value without having to OVERLOAD the function with all the possible data types. A template can call itself.

A macro defines the meaning for an identifier.The preprocessor replaces macro in the form of strings in the source code with values derived from the macro definition.The most common usage for macros defines a global symbol that represents a value. A macro cannot call itself.

On the contrary, a template allows you to create generic functions that admit any data type as parameters and return a value without having to overload the function with all the possible data types. A template can call itself.



Discussion

No Comment Found