summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.ninja1
-rw-r--r--ellipse/ellipse.cc3
-rw-r--r--ellipse/ellipse.hh22
3 files changed, 22 insertions, 4 deletions
diff --git a/build.ninja b/build.ninja
index 4eac415..b0e0dc9 100644
--- a/build.ninja
+++ b/build.ninja
@@ -1,4 +1,5 @@
cc = clang++
+# -DNO_CXX_20 -DNO_CXX_17
cxxflags = -Ofast -std=c++20 -Weverything -Wno-c++98-compat
out_dir = out
name = ellipse
diff --git a/ellipse/ellipse.cc b/ellipse/ellipse.cc
index fd4c34c..0437d28 100644
--- a/ellipse/ellipse.cc
+++ b/ellipse/ellipse.cc
@@ -5,7 +5,8 @@
#include "ellipse.hh"
-// Enable this if for some reason your compiler doesn't support C++20.
+// Define this here or in your CXX arguments if for some reason your compiler
+// doesn't support C++20.
// #define NO_CXX_20
void ellipse::set_axis(double _major, double _minor) {
diff --git a/ellipse/ellipse.hh b/ellipse/ellipse.hh
index 9296954..02d3ae1 100644
--- a/ellipse/ellipse.hh
+++ b/ellipse/ellipse.hh
@@ -1,6 +1,10 @@
#ifndef ELLIPSE_HH
#define ELLIPSE_HH
+// Define this here or in your CXX arguments if for some reason your compiler
+// doesn't support C++17.
+// #define NO_CXX_17
+
class ellipse {
private:
double major; // a
@@ -19,9 +23,21 @@ public:
// Getters
// double get_major();
// double get_minor();
- [[nodiscard]] double get_area() const;
- [[nodiscard]] double get_circumference() const;
- [[nodiscard]] double get_eccentricity() const;
+#ifndef NO_CXX_17
+ [[nodiscard]]
+#endif
+ double
+ get_area() const;
+#ifndef NO_CXX_17
+ [[nodiscard]]
+#endif
+ double
+ get_circumference() const;
+#ifndef NO_CXX_17
+ [[nodiscard]]
+#endif
+ double
+ get_eccentricity() const;
void compute();
void get_ellipse_description() const;