forked from OpenMS/OpenMS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTutorial_DPosition.cpp
More file actions
35 lines (28 loc) · 837 Bytes
/
Copy pathTutorial_DPosition.cpp
File metadata and controls
35 lines (28 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
// SPDX-License-Identifier: BSD-3-Clause
//
#include <OpenMS/DATASTRUCTURES/DPosition.h>
#include <iostream>
using namespace OpenMS;
Int main()
{
DPosition<2> pos {-8.15, 47.11};
static_assert(pos.size() == 2);
std::cout << "largest possible value: " << DPosition<2>::maxPositive() << '\n';
// make values in all dimensions positive and print
std::cout << "abs: " << pos.abs() << '\n';
// manipulate individual dimensions
pos[0] = -3.15;
pos[1] = 7.11;
for (Size i = 0; i < pos.DIMENSION; ++i)
{
std::cout << "Dimension " << i << ": " << pos[i] << std::endl;
}
// same thing
int i = 0;
for (const auto e : pos)
{
std::cout << "Dimension " << i++ << ": " << e << std::endl;
}
return 0;
} //end of main