Vita
population_coord.tcc
1/**
2 * \file
3 * \remark This file is part of VITA.
4 *
5 * \copyright Copyright (C) 2017-2019 EOS di Manlio Morini.
6 *
7 * \license
8 * This Source Code Form is subject to the terms of the Mozilla Public
9 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
10 * You can obtain one at http://mozilla.org/MPL/2.0/
11 */
12
13#if !defined(VITA_POPULATION_H)
14# error "Don't include this file directly, include the specific .h instead"
15#endif
16
17#if !defined(VITA_POPULATION_COORD_TCC)
18#define VITA_POPULATION_COORD_TCC
19
20///
21/// Holds the coordinates of an individual in a population.
22///
23template<class T>
24struct population<T>::coord
25{
26 unsigned layer;
27 unsigned index;
28
29 bool operator==(coord rhs) const
30 { return layer == rhs.layer && index == rhs.index; }
31
32 bool operator!=(coord rhs) const
33 { return !(*this == rhs); }
34
35 bool operator<(coord rhs) const
36 {
37 return layer < rhs.layer
38 || (layer == rhs.layer && index < rhs.index);
39 }
40}; // struct coord
41
42#endif // include guard