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.
+Built for C++
+Mr.Docs models C++ accurately: overload sets, concepts and constraints, deduced return types, aliases, constants, SFINAE, inherited and hidden members, niebloids, and more.
+Multiple output formats
+Export to AsciiDoc, HTML, or XML - or extend it with your own generator plugins.
+Customizable
+Highly configurable: control output format and theme, tailor symbol selection, and tune generation to match your project’s standards. +
+More Code, Fewer Workarounds
+Mr.Docs lets you keep code simple and maintainable.
+ +-
+
- Accurate rendering of attributes and exception specifications (e.g. [[noreturn]], noexcept). +
/** Exit the program.
+
+ The program will end immediately.
+
+ @note This function does not return.
+*/
+[[noreturn]]
+void
+terminate() noexcept;
+ terminate
+Synopsis
+<terminate.cpp>
+
+[[noreturn]]
+void
+terminate() noexcept;
+
+
+Description
+The program will end immediately.
+NOTE
+This function does not return.
+-
+
- 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);
+ distance
+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.
+Return Value
+The distance between the two points +Parameters
+| 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 | +
-
+
- Use directives to capture semantics beyond the signature. +
/** 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
+Synopsis
+<is_prime.cpp>
+
+bool
+is_prime(unsigned long long n) noexcept;
+
+
+Description
+Complexity
+Linear in n.
+Return Value
+Whether or not n is prime. +Parameters
+| Name | +Description | +
|---|---|
| n | +The number to test | +
-
+
- Understands concepts, constraints, and SFINAE—rendered as you wrote them. +
#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
+Synopsis
+<sqrt.cpp>
+
+template<typename T>
+T
+sqrt(T value)
+requires std::is_integral_v<T>;
+
+
+Description
+This function calculates the square root of a given integral value using bit manipulation.
+Exceptions
+| Name | +Thrown on | +
|---|---|
std::invalid_argument |
+if the input value is negative. | +
Return Value
+The square root of the input value. +Template Parameters
+| Name | +Description | +
|---|---|
| T | +The type of the input value. Must be an integral type. | +
Parameters
+| Name | +Description | +
|---|---|
| value | +The integral value to compute the square root of. | +
Like what you see? Star us on GitHub: + +
+