Molassembler  2.0.1
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ToStl.h
Go to the documentation of this file.
1 
11 #ifndef INLCUDE_MOLASSEMBLER_TEMPLE_CONSTEXPR_TO_STL_H
12 #define INLCUDE_MOLASSEMBLER_TEMPLE_CONSTEXPR_TO_STL_H
13 
16 
17 #include <vector>
18 #include <map>
19 #include <set>
20 
21 namespace Scine {
22 namespace Molassembler {
23 namespace Temple {
24 
26 template<typename T, size_t size>
27 std::array<T, size> toSTL(const Array<T, size>& array) {
28  return array.getArray();
29 }
30 
32 template<typename T, size_t size>
33 std::vector<T> toSTL(const DynamicArray<T, size>& dynamicArray) {
34  std::vector<T> data;
35  data.reserve(dynamicArray.size());
36 
37  for(unsigned i = 0; i < dynamicArray.size(); ++i) {
38  data.push_back(dynamicArray.at(i));
39  }
40 
41  return data;
42 }
43 
45 template<typename T, size_t size>
46 std::set<T> toSTL(const DynamicSet<T, size>& dynamicSet) {
47  std::set<T> returnSet;
48 
49  for(const auto& element : dynamicSet) {
50  returnSet.insert(element);
51  }
52 
53  return returnSet;
54 }
55 
56 } // namespace Temple
57 } // namespace Molassembler
58 } // namespace Scine
59 
60 #endif
std::array< T, size > toSTL(const Array< T, size > &array)
Converts an Array into a std::array.
Definition: ToStl.h:27
double element(const PositionCollection &normalizedPositions, const Elements::Rotation &rotation)
Returns the CSM for a Rotation symmetry element along the rotation axis without optimizing the coordi...
Definition: DynamicArray.h:26
std::array-like class
Tree-based set.
Definition: DynamicSet.h:34
A std::map-like class based on BTree (but max size is space allocated)
constexpr std::array< T, nItems > getArray() const
Explicit conversion to a std::array.
Definition: Array.h:490