Skip to content

Commit ef19698

Browse files
committed
Removed C++17 and C++20 code.
1 parent 35ed3a9 commit ef19698

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ int main()
102102
// put space after comma of interval label? (a,b) vs (a, b)
103103
.space_after_comma = false,
104104

105-
// left brace override, otherwise determined from interval kind
106-
.left_brace = std::nullopt,
105+
// left brace override enabled if not 0, otherwise determined from interval kind
106+
.left_brace = '\0',
107107

108-
// right brace override, otherwise determined from interval kind
109-
.right_brace = std::nullopt,
108+
// right brace override enabled if not 0, otherwise determined from interval kind
109+
.right_brace = '\0',
110110

111111
// edge attributes
112112
.edge_attributes = {"color=blue"},

example/dot_graph/main.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ int main()
3737
.space_after_comma = false,
3838

3939
// left brace override, otherwise determined from interval kind
40-
.left_brace = std::nullopt,
40+
.left_brace = '\0',
4141

4242
// right brace override, otherwise determined from interval kind
43-
.right_brace = std::nullopt,
43+
.right_brace = '\0',
4444

4545
// edge attributes
4646
.edge_attributes = {"color=blue"},

include/interval-tree/dot_graph.hpp

+13-14
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#include <iostream>
66
#include <string>
7-
#include <optional>
87
#include <vector>
98
#include <utility>
109

@@ -17,8 +16,8 @@ namespace lib_interval_tree
1716
std::vector<std::string> extra_node_attributes = {};
1817
std::vector<std::string> extra_statements = {};
1918
bool space_after_comma = false;
20-
std::optional<char> left_brace = std::nullopt;
21-
std::optional<char> right_brace = std::nullopt;
19+
char left_brace = '\0';
20+
char right_brace = '\0';
2221
std::vector<std::string> edge_attributes = {};
2322
std::string indent = "\t";
2423
};
@@ -40,27 +39,27 @@ namespace lib_interval_tree
4039
using ival_type = typename TreeT::interval_type;
4140

4241
const auto determine_brace = []() {
43-
if (std::is_same_v<typename ival_type::interval_kind, closed>)
42+
if (std::is_same<typename ival_type::interval_kind, closed>::value)
4443
return "[]";
45-
else if (std::is_same_v<typename ival_type::interval_kind, left_open>)
44+
else if (std::is_same<typename ival_type::interval_kind, left_open>::value)
4645
return "(]";
47-
else if (std::is_same_v<typename ival_type::interval_kind, right_open>)
46+
else if (std::is_same<typename ival_type::interval_kind, right_open>::value)
4847
return "[)";
49-
else if (std::is_same_v<typename ival_type::interval_kind, open>)
48+
else if (std::is_same<typename ival_type::interval_kind, open>::value)
5049
return "()";
51-
else if (std::is_same_v<typename ival_type::interval_kind, closed_adjacent>)
50+
else if (std::is_same<typename ival_type::interval_kind, closed_adjacent>::value)
5251
return "[]";
5352
else
5453
return "[]";
5554
};
5655

57-
if (settings_.left_brace)
58-
left_brace_ = *settings_.left_brace;
56+
if (settings_.left_brace != '\0')
57+
left_brace_ = settings_.left_brace;
5958
else
6059
left_brace_ = determine_brace()[0];
6160

62-
if (settings_.right_brace)
63-
right_brace_ = *settings_.right_brace;
61+
if (settings_.right_brace != '\0')
62+
right_brace_ = settings_.right_brace;
6463
else
6564
right_brace_ = determine_brace()[1];
6665
}
@@ -78,7 +77,7 @@ namespace lib_interval_tree
7877
void make_label(T const& ival)
7978
{
8079
#if __cplusplus >= 201703L
81-
if constexpr (std::is_same_v<typename T::interval_kind, dynamic>)
80+
if constexpr (std::is_same<typename T::interval_kind, dynamic>::value)
8281
{
8382
stream_ << (ival.left_border() == interval_border::open ? '(' : '[') << ival.low()
8483
<< (settings_.space_after_comma ? ", " : ",") << ival.high()
@@ -203,7 +202,7 @@ namespace lib_interval_tree
203202
template <typename TreeT>
204203
void draw_dot_graph(std::ostream& stream, TreeT const& tree, dot_graph_draw_settings const& settings = {})
205204
{
206-
detail::graph_painter painter{stream, tree, settings};
205+
detail::graph_painter<TreeT> painter{stream, tree, settings};
207206
painter.make_header();
208207
if (tree.empty())
209208
{

0 commit comments

Comments
 (0)