post() with const ref.

Added "safety" of passing move-able reference
is an illusion since no use_count()==1 test
is done.  Instead extra (shallow) copies
were made for each subscriber.

Instead.  Pass const reference, redefine
MonitorControlOp::post() to transfer ownership,
and make only a single copy in SharedPV::post().
This commit is contained in:
Michael Davidsaver
2020-07-23 11:30:54 -07:00
parent 7debb1fae3
commit 24f3478c98
8 changed files with 29 additions and 21 deletions
+1 -1
View File
@@ -100,7 +100,7 @@ int main(int argc, char* argv[])
val["value"] = count++;
pv.post(std::move(val));
pv.post(val);
std::cout<<"Count "<<count<<"\n";
}