Single Source of Truth
Mr.Docs turns the documentation comments that live next to your C++ declarations into authoritative reference pages. One source of truth—your code.
Mr.Docs turns the documentation comments that live next to your C++ declarations into authoritative reference pages. One source of truth—your code.
Mr.Docs models C++ accurately: overload sets, concepts and constraints, deduced return types, aliases, constants, SFINAE, inherited and hidden members, algorithm function objects, and more.
Export to any output format and extend it with your own generator plugins.
Highly configurable: control output format and theme, tailor symbol selection, and tune generation to match your project’s standards.
Attributes & Specifiers
Accurate rendering of attributes and exception specifications (e.g. [[noreturn]], noexcept).
/** Exit the program.
The program will end immediately.
@note Functions registered with `std::atexit` are not invoked.
*/
[[noreturn]]
void
terminate() noexcept;
Exit the program.
Declared in <terminate.hpp>
[[noreturn]]
void
terminate() noexcept;
The program will end immediately.
Functions registered with std::atexit are not invoked.
This function does not return.
Parameters & Returns
Documentation comments become structured reference pages—synopsis, description, parameters, and returns.
/** 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);
Return the distance between two points
Declared in <distance.hpp>
double
distance(
double x0,
double y0,
double x1,
double y1);
This function returns the distance between two points according to the Euclidean distance formula.
The distance between the two points
| Name | Description |
|---|---|
| x0 | The x-coordinate of the first point |
| y0 | The y-coordinate of the first point |
| x1 | The x-coordinate of the second point |
| y1 | The y-coordinate of the second point |
Directives & Semantics
Use directives to capture what the signature cannot say: preconditions, postconditions, and exceptions.
#include <vector>
/** Insert a value into a sorted vector, keeping it sorted.
@pre `v` is sorted in ascending order.
@post `v` is sorted in ascending order and contains `value`.
@param v The sorted vector to insert into.
@param value The value to insert.
@return An iterator to the inserted element.
@throws std::bad_alloc If the vector has to grow and cannot.
*/
std::vector<int>::iterator
insert_sorted(std::vector<int>& v, int value);
Insert a value into a sorted vector, keeping it sorted.
Declared in <insert_sorted.hpp>
std::vector<int>::iterator
insert_sorted(
std::vector<int>& v,
int value);
| Name | Thrown on |
|---|---|
std::bad_alloc | If the vector has to grow and cannot. |
An iterator to the inserted element.
| Name | Description |
|---|---|
| v | The sorted vector to insert into. |
| value | The value to insert. |
v is sorted in ascending order.v is sorted in ascending order and contains value.Templates & SFINAE
Understands concepts, constraints, and SFINAE—rendered as you wrote them.
#include <type_traits>
/** Computes the integer square root \f$\lfloor\sqrt{value}\rfloor\f$.
This function calculates the square root of a given integral value
using bit manipulation, in $O(\log value)$ time.
@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);
Computes the integer square root \(\lfloor\sqrt{value}\rfloor\).
Declared in <sqrt.hpp>
template<typename T>
T
sqrt(T value)
requires std::is_integral_v<T>;
This function calculates the square root of a given integral value using bit manipulation, in \(O(\log value)\) time.
| Name | Thrown on |
|---|---|
std::invalid_argument | If the input value is negative. |
The square root of the input value.
| Name | Description |
|---|---|
| T | The type of the input value. Must be an integral type. |
| Name | Description |
|---|---|
| value | The integral value to compute the square root of. |
Function Objects
Function objects are documented as callable entities—operator() parameter list and return type appear directly on the variable.
struct abs_fn
{
/** Compute the absolute value.
@param x The input value.
@return The absolute value of x.
*/
double
operator()(double x) const noexcept;
};
/** Return the absolute value of a number. */
constexpr abs_fn abs = {};
Compute the absolute value.
Declared in <function_object.hpp>
double
abs(double x) noexcept;
This function is defined as an Algorithm Function Object (AFO).
The absolute value of x.
| Name | Description |
|---|---|
| x | The input value. |
Implementation Details
Keep private types out of the reference: every mention of one, in any signature, renders as "implementation-defined".
#include <filesystem>
namespace detail {
/** The object that holds the lock.
@implementationdefined
*/
class file_lock
{
public:
~file_lock();
};
} // namespace detail
/** Lock a file for exclusive access.
The lock is held until the returned object is destroyed.
@param path The path of the file to lock.
@return An object that holds the lock.
@throws std::system_error If the file cannot be locked.
*/
[[nodiscard]]
detail::file_lock
lock_file(std::filesystem::path const& path);
Lock a file for exclusive access.
Declared in <lock_file.hpp>
[[nodiscard]]
/* implementation-defined */
lock_file(std::filesystem::path const& path);
The lock is held until the returned object is destroyed.
| Name | Thrown on |
|---|---|
std::system_error | If the file cannot be locked. |
| Name | Description |
|---|---|
| path | The path of the file to lock. |
Action Time
Install Mr.Docs and generate your first reference site in minutes. No excuses.