Skip to content

Commit e21d977

Browse files
committed
Move overloaded() magic function into its own header file
1 parent 8e5bf4b commit e21d977

4 files changed

Lines changed: 28 additions & 12 deletions

File tree

src/geom-functions.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
*/
99

1010
#include "geom-functions.hpp"
11+
1112
#include "geom-boost-adaptor.hpp"
13+
#include "overloaded.hpp"
1214

1315
#include <algorithm>
1416
#include <cmath>

src/geom.hpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -403,16 +403,4 @@ std::size_t dimension(geometry_t const &geom);
403403

404404
} // namespace geom
405405

406-
// This magic is used for visiting geometries. For an explanation see for
407-
// instance here:
408-
// https://arne-mertz.de/2018/05/overload-build-a-variant-visitor-on-the-fly/
409-
template <class... Ts>
410-
struct overloaded : Ts...
411-
{
412-
using Ts::operator()...;
413-
};
414-
415-
template <class... Ts>
416-
overloaded(Ts...) -> overloaded<Ts...>;
417-
418406
#endif // OSM2PGSQL_GEOM_HPP

src/overloaded.hpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#ifndef OSM2PGSQL_OVERLOADED_HPP
2+
#define OSM2PGSQL_OVERLOADED_HPP
3+
4+
/**
5+
* SPDX-License-Identifier: GPL-2.0-or-later
6+
*
7+
* This file is part of osm2pgsql (https://osm2pgsql.org/).
8+
*
9+
* Copyright (C) 2006-2023 by the osm2pgsql developer community.
10+
* For a full list of authors see the git log.
11+
*/
12+
13+
// This magic is used for visiting geometries. For an explanation see for
14+
// instance here:
15+
// https://arne-mertz.de/2018/05/overload-build-a-variant-visitor-on-the-fly/
16+
template <class... Ts>
17+
struct overloaded : Ts...
18+
{
19+
using Ts::operator()...;
20+
};
21+
22+
template <class... Ts>
23+
overloaded(Ts...) -> overloaded<Ts...>;
24+
25+
#endif // OSM2PGSQL_OVERLOADED_HPP

src/wkb.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "wkb.hpp"
1111

1212
#include "format.hpp"
13+
#include "overloaded.hpp"
1314

1415
#include <array>
1516
#include <cassert>

0 commit comments

Comments
 (0)