Skip to content

Commit 78c510b

Browse files
committed
Basic_indenting_stream_guard: do nothing if the string is empty
1 parent b53a704 commit 78c510b

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

Constrained_triangulation_3/include/CGAL/Conforming_constrained_Delaunay_triangulation_3.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,11 +2230,10 @@ class Conforming_constrained_Delaunay_triangulation_3_impl : public Conforming_D
22302230
} // end of `remove_Steiner_vertex_from_cdt_2`
22312231

22322232
bool move_one_Steiner_vertex_to_the_volume(Vertex_handle v) {
2233-
std::optional<decltype(CGAL::IO::make_indenting_guards("| "))> indent_guards;
22342233
if(this->debug().move_Steiner_vertices()) {
22352234
std::cerr << "Moving Steiner vertex " << display_vert(v) << " to the volume\n";
2236-
indent_guards.emplace(IO::make_indenting_guards(" |"));
22372235
}
2236+
auto indent_guards = CGAL::IO::make_indenting_guards(this->debug().move_Steiner_vertices() ? "| " : "");
22382237

22392238
const auto incident_constrained_facet_opt =
22402239
find_in_incident_facets(v, [this](Facet f) { return is_facet_constrained(f); });
@@ -5586,16 +5585,15 @@ class Conforming_constrained_Delaunay_triangulation_3_impl : public Conforming_D
55865585
};
55875586

55885587
auto test_cell = [&](Cell_handle cell) {
5589-
std::optional<decltype(CGAL::IO::make_indenting_guards("| "))> indent_guards;
55905588
if constexpr(cdt_3_can_use_cxx20_format()) if(this->debug().regions()) {
55915589
std::cerr << cdt_3_format("test_cell #{}\n {}\n {}\n {}\n {}\n",
55925590
cell->time_stamp(),
55935591
IO::oformat(cell->vertex(0), with_point_and_info),
55945592
IO::oformat(cell->vertex(1), with_point_and_info),
55955593
IO::oformat(cell->vertex(2), with_point_and_info),
55965594
IO::oformat(cell->vertex(3), with_point_and_info));
5597-
indent_guards.emplace(CGAL::IO::make_indenting_guards("| "));
55985595
}
5596+
auto indent_guards = CGAL::IO::make_indenting_guards(this->debug().regions() ? "| " : "");
55995597
bool does_intersect = false;
56005598
for(int i = 0; i < 4; ++i) {
56015599
const auto v0 = cell->vertex(i);

Stream_support/include/CGAL/IO/Indenting_ostream.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,10 @@ class Basic_indenting_stream_guard
237237
, original_buf_(stream.rdbuf())
238238
, indenting_buf_(*original_buf_, indent_string)
239239
{
240+
if(indent_string.empty()) {
241+
// No indentation, just use the original buffer
242+
return;
243+
}
240244
if(auto old_buf = dynamic_cast<streambuf_type*>(original_buf_)) {
241245
original_indent_string_ = old_buf->indent_string();
242246
old_buf->set_indent_string(original_indent_string_ + indent_string);

0 commit comments

Comments
 (0)