Open3D (C++ API)  0.18.0+252c867
Preprocessor.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
20 #define OPEN3D_FIX_MSVC_(...) __VA_ARGS__
21 
25 #define OPEN3D_CONCAT_IMPL_(s1, s2) s1##s2
26 #define OPEN3D_CONCAT(s1, s2) OPEN3D_CONCAT_IMPL_(s1, s2)
27 
31 #define OPEN3D_STRINGIFY_IMPL_(s) #s
32 #define OPEN3D_STRINGIFY(s) OPEN3D_STRINGIFY_IMPL_(s)
33 
39 #define OPEN3D_GET_NTH_ARG_(...) \
40  OPEN3D_FIX_MSVC_(OPEN3D_GET_NTH_ARG_IMPL_(__VA_ARGS__))
41 #define OPEN3D_GET_NTH_ARG_IMPL_(arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
42  arg8, arg9, arg10, N, ...) \
43  N
44 #define OPEN3D_REVERSE_NUM_SEQUENCE_() 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
45 #define OPEN3D_NUM_ARGS(...) \
46  OPEN3D_GET_NTH_ARG_(__VA_ARGS__, OPEN3D_REVERSE_NUM_SEQUENCE_())
47 
64 #define OPEN3D_OVERLOAD(func, ...) \
65  OPEN3D_CONCAT(func, OPEN3D_NUM_ARGS(__VA_ARGS__))