Condition the creation of the weighted point to a good stream reading

This commit is contained in:
Mael 2020-04-01 17:34:22 +02:00 committed by GitHub
parent fdb17cb3f1
commit 1747e8e932
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -41,11 +41,11 @@ int main()
int n;
is >> n;
std::cout << "Reading " << n << " points " << std::endl;
for( ; n>0 ; n--) {
for( ; n>0 ; n--)
{
Bare_point bp;
is >> bp;
Weighted_point p(bp, 0.0001 * random.get_double(0., 0.015625)); // arbitrary weights
pts.push_back(p);
if(is >> bp)
pts.emplace_back(bp, 0.0001 * random.get_double(0., 0.015625)); // arbitrary weights
}
// Define the periodic cube