Fix a warning in SDG2/SDG_Linf_2

The call to source() (resp. target()) is a call to compute_source()
(resp. compute_target()) which cofuses the compiler because it does
not know that the site being considered here is known to be
an input site, for which these computations involving uninitiliazed
data cannot take place.

The functions source/target_of_supporting_site() directly return
what source()/target() return in the case of an input site.

For some reason the compiler doesn't complain about point(), which
should do the same. One could use source_of_supporting_site
since it returns p_[0] (which is what we want when we call
site.point() with an input site), but it would be confusing,
for readers this time.
This commit is contained in:
Mael Rouxel-Labbé 2020-04-06 18:33:26 +02:00
parent 5abeddadf4
commit cc18ed332c
1 changed files with 4 additions and 4 deletions

View File

@ -246,11 +246,11 @@ public:
if ( t.is_segment() ) {
Point_handle_pair php =
this->register_input_site(t.source(), t.target());
this->register_input_site(t.source_of_supporting_site(), t.target_of_supporting_site());
Storage_site_2 ss =
this->st_.construct_storage_site_2_object()(php.first, php.second);
Vertex_handle v =
insert_segment(t.source(), t.target(), ss, UNDEFINED_LEVEL);
insert_segment(t.source_of_supporting_site(), t.target_of_supporting_site(), ss, UNDEFINED_LEVEL);
if ( v == Vertex_handle() ) {
this->unregister_input_site( php.first, php.second );
}
@ -282,12 +282,12 @@ public:
if ( t.is_segment() ) {
Point_handle_pair php =
this->register_input_site(t.source(), t.target());
this->register_input_site(t.source_of_supporting_site(), t.target_of_supporting_site());
Storage_site_2 ss =
this->st_.construct_storage_site_2_object()(php.first, php.second);
ss.set_info(info);
Vertex_handle v =
insert_segment(t.source(), t.target(), ss, UNDEFINED_LEVEL);
insert_segment(t.source_of_supporting_site(), t.target_of_supporting_site(), ss, UNDEFINED_LEVEL);
if ( v == Vertex_handle() ) {
this->unregister_input_site( php.first, php.second );
}