Simple code, simple documentation
MrDocs understands C++ so you can focus on keeping the code simple.
Single Source of Truth
Mr. Docs takes a specially formatted comment, called a Javadoc, which precedes a C++ declaration and renders it to form a reference as part of documentation.
It understands C++
Mr. Docs understands C++: Overload sets, private APIs, Concepts and constraints, unspecified return types, aliases, constants, SFINAE, hidden base classes, niebloids, and coroutines.
Multiple output formats
Choose from multiple output formats: Asciidoc, HTML, or XML.
Customizable
Mr. Docs is highly customizable. You can change the output format, the theme, and even the way the documentation is generated.
Examples
Examples to discover MrDocs in action.
Boost.URL Antora documentation.
Boost.URL multi-page Asciidoc documentation.
Boost.URL single-page Asciidoc documentation.
Boost.URL single-page HTML documentation.
Boost.URL XML documentation.
Boost.Scope multi-page Asciidoc documentation.
Boost.Scope single-page Asciidoc documentation.
More Code, Fewer Workarounds
MrDocs let's you keep the code simple and maintainable.
- MrDocs understands C++ features such as attributes and noexcept functions.
/** Exit the program.
The program will end immediately.
@note This function does not return.
*/
[[noreturn]]
void
terminate() noexcept;
terminate
Exit the program.
Synopsis
<terminate.cpp>
void
terminate() noexcept;
Description
The program will end immediately.
NOTE
This function does not return.
- Specially formatted comments are rendered to form a reference as part of documentation.
/** Return the distance between two points
This function returns the distance between two points
according to the Euclidean distance formula.
@param x0 The x-coordinate of the first point
@param y0 The y-coordinate of the first point
@param x1 The x-coordinate of the second point
@param y1 The y-coordinate of the second point
@return The distance between the two points
*/
double
distance(double x0, double y0, double x1, double y1);
distance
Return the distance between two points
Synopsis
<distance.cpp>
double
distance(
double x0,
double y0,
double x1,
double y1);
Description
This function returns the distance between two points according to the Euclidean distance formula.
Parameters
Name | Description |
---|---|
x0 | |
y0 | |
x1 | |
y1 |
- Special directives are used to describe details about the symbols.
/** Return true if a number is prime.
@par Complexity
Linear in n.
@return Whether or not n is prime.
@param n The number to test
*/
bool
is_prime(unsigned long long n) noexcept;
is_prime
Return true if a number is prime.
Synopsis
<is_prime.cpp>
bool
is_prime(unsigned long long n) noexcept;
Description
Linear in n.
Parameters
Name | Description |
---|---|
n |
- It understands concepts, constraints and SFINAE.
#include <type_traits>
#include <stdexcept>
/** Computes the square root of an integral value.
This function calculates the square root of a
given integral value using bit manipulation.
@throws std::invalid_argument if the input value is negative.
@tparam T The type of the input value. Must be an integral type.
@param value The integral value to compute the square root of.
@return The square root of the input value.
*/
template <typename T>
std::enable_if_t<std::is_integral_v<T>, T> sqrt(T value) {
if (value < 0) {
throw std::invalid_argument(
"Cannot compute square root of a negative number");
}
T result = 0;
// The second-to-top bit is set
T bit = 1 << (sizeof(T) * 8 - 2);
while (bit > value) bit >>= 2;
while (bit != 0) {
if (value >= result + bit) {
value -= result + bit;
result += bit << 1;
}
result >>= 1;
bit >>= 2;
}
return result;
}
sqrt
Computes the square root of an integral value.
Synopsis
<sqrt.cpp>
template<typename T>
std::T
sqrt(T value);
Description
This function calculates the square root of a given integral value using bit manipulation.
Exceptions
Name | Thrown on |
---|---|
if |
Template Parameters
Name | Description |
---|---|
T |
Parameters
Name | Description |
---|---|
value |
Give us a Star on GitHub: