dyng
DynamicGraphLayout
dyng
container.h
1
/*
2
Copyright 2020 František Bráblík
3
4
Licensed under the Apache License, Version 2.0 (the "License");
5
you may not use this file except in compliance with the License.
6
You may obtain a copy of the License at
7
8
http://www.apache.org/licenses/LICENSE-2.0
9
10
Unless required by applicable law or agreed to in writing, software
11
distributed under the License is distributed on an "AS IS" BASIS,
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
See the License for the specific language governing permissions and
14
limitations under the License.
15
*/
16
#pragma once
17
18
#include <vector>
19
#include <unordered_map>
20
21
namespace
dyng {
22
23
namespace
detail {
24
26
33
template
<
typename
T,
typename
Id>
34
struct
container
{
35
std::vector<T> vec;
36
std::unordered_map<Id, unsigned> map;
37
const
T& at(Id
id
)
const
{
return
vec[map.at(
id
)]; }
38
T& at(Id
id
) {
return
vec[map.at(
id
)]; }
39
};
40
41
}
// namespace detail
42
43
}
// namespace dyng
dyng::detail::container
Contains a vector of graph entities and a map to them.
Definition:
container.h:34
Generated on Sun Jan 2 2022 02:00:41 for dyng by
1.8.17