4
4
5
5
#include < iostream>
6
6
#include < string>
7
- #include < optional>
8
7
#include < vector>
9
8
#include < utility>
10
9
@@ -17,8 +16,8 @@ namespace lib_interval_tree
17
16
std::vector<std::string> extra_node_attributes = {};
18
17
std::vector<std::string> extra_statements = {};
19
18
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 ' ;
22
21
std::vector<std::string> edge_attributes = {};
23
22
std::string indent = " \t " ;
24
23
};
@@ -40,27 +39,27 @@ namespace lib_interval_tree
40
39
using ival_type = typename TreeT::interval_type;
41
40
42
41
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 )
44
43
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 )
46
45
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 )
48
47
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 )
50
49
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 )
52
51
return " []" ;
53
52
else
54
53
return " []" ;
55
54
};
56
55
57
- if (settings_.left_brace )
58
- left_brace_ = * settings_.left_brace ;
56
+ if (settings_.left_brace != ' \0 ' )
57
+ left_brace_ = settings_.left_brace ;
59
58
else
60
59
left_brace_ = determine_brace ()[0 ];
61
60
62
- if (settings_.right_brace )
63
- right_brace_ = * settings_.right_brace ;
61
+ if (settings_.right_brace != ' \0 ' )
62
+ right_brace_ = settings_.right_brace ;
64
63
else
65
64
right_brace_ = determine_brace ()[1 ];
66
65
}
@@ -78,7 +77,7 @@ namespace lib_interval_tree
78
77
void make_label (T const & ival)
79
78
{
80
79
#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 )
82
81
{
83
82
stream_ << (ival.left_border () == interval_border::open ? ' (' : ' [' ) << ival.low ()
84
83
<< (settings_.space_after_comma ? " , " : " ," ) << ival.high ()
@@ -203,7 +202,7 @@ namespace lib_interval_tree
203
202
template <typename TreeT>
204
203
void draw_dot_graph (std::ostream& stream, TreeT const & tree, dot_graph_draw_settings const & settings = {})
205
204
{
206
- detail::graph_painter painter{stream, tree, settings};
205
+ detail::graph_painter<TreeT> painter{stream, tree, settings};
207
206
painter.make_header ();
208
207
if (tree.empty ())
209
208
{
0 commit comments