What does the comment of 3 bars in C ++ mean?

12

I know that there are basically 2 types of comments, those of a line // and the multilines /* */ , but if I comment with 3 bars until the color of the comment changes, such as below Qt and Visual Studio :

If the color changes there should be a reason for this, then what kind of comment would this be?

    
asked by anonymous 13.12.2018 / 14:36

3 answers

11

In visual studio the 3 bars indicate documentation, not just comment. It is used to embellish comments that will be formatted specifically through your editor or some other tool such as documentation for a class, method, namespace, etc. That is, after the 3 bars you would want to put the project documentation;)

    
13.12.2018 / 14:47
8

If the comment with 3 slashes is the same as C #, I believe it is to document so that it generates XML documents.

See on this link how to insert XML comments for documentation generation.

    
13.12.2018 / 14:46
3

Normally three bars are used when creating documentation for your code. You can use Doxygen for this. Doxygen There are some specific tags that are used to define how the document will be generated. Below is an example of an excerpt with the \ brief, \ param \ return

/// \brief This metafunction converts degrees to radians.
/// \param T angle in degrees.
/// \return T angle in radians.
template <typename T>
constexpr inline T degreeToRadians(const T angle)
{
    return angle * ((PI<T>) / 180);
}
    
18.12.2018 / 20:53