We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 65f3327 commit 3dfe0d7Copy full SHA for 3dfe0d7
docs/cpp/constexpr-cpp.md
@@ -85,7 +85,7 @@ constexpr float exp(float x, int n)
85
return n == 0 ? 1 :
86
n % 2 == 0 ? exp(x * x, n / 2) :
87
exp(x * x, (n - 1) / 2) * x;
88
-};
+}
89
```
90
91
> [!TIP]
@@ -112,15 +112,15 @@ constexpr float exp(float x, int n)
112
113
114
115
116
117
// Pass by reference
118
constexpr float exp2(const float& x, const int& n)
119
{
120
121
n % 2 == 0 ? exp2(x * x, n / 2) :
122
exp2(x * x, (n - 1) / 2) * x;
123
124
125
// Compile-time computation of array length
126
template<typename T, int N>
0 commit comments