Home > OS >  How to deal with 'Template' and 'Docstring' simultaneously in C
How to deal with 'Template' and 'Docstring' simultaneously in C

Time:11-14

What is the standard order of writing a class definition with associated template and docstring, to make it recognisable by the IDEs ?

Is it:

<docstring>
<template>
<class declaration/ definition>

Or:

<template>
<docstring>
<class declaration/ definition>

CodePudding user response:

The standard way of ordering template and docstring is as follows:

  • Docstring
  • Template
  • Class declaration / definition

Example:

/**
* Class of Traveling Salesman Problem : Ctor :-
* @param nov: order of Graph (|V|)
* @param startVertex: Starting Vertex for Hamiltonian Traversal
* @param costMatrix (optional): accepts cost matrix, if not provided, then one should call input() function
*/
template<typename DT>
class TSP
{
    ...
};

Sidenote : Code snippet behaviour verified on MS Visual Studio IDE

  • Related