ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
Preprocessor.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
20 #define CLOUDVIEWER_FIX_MSVC_(...) __VA_ARGS__
21 
25 #define CLOUDVIEWER_CONCAT_IMPL_(s1, s2) s1##s2
26 #define CLOUDVIEWER_CONCAT(s1, s2) CLOUDVIEWER_CONCAT_IMPL_(s1, s2)
27 
31 #define CLOUDVIEWER_STRINGIFY_IMPL_(s) #s
32 #define CLOUDVIEWER_STRINGIFY(s) CLOUDVIEWER_STRINGIFY_IMPL_(s)
33 
39 #define CLOUDVIEWER_GET_NTH_ARG_(...) \
40  CLOUDVIEWER_FIX_MSVC_(CLOUDVIEWER_GET_NTH_ARG_IMPL_(__VA_ARGS__))
41 #define CLOUDVIEWER_GET_NTH_ARG_IMPL_(arg1, arg2, arg3, arg4, arg5, arg6, \
42  arg7, arg8, arg9, arg10, N, ...) \
43  N
44 #define CLOUDVIEWER_REVERSE_NUM_SEQUENCE_() 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
45 #define CLOUDVIEWER_NUM_ARGS(...) \
46  CLOUDVIEWER_GET_NTH_ARG_(__VA_ARGS__, CLOUDVIEWER_REVERSE_NUM_SEQUENCE_())
47 
65 #define CLOUDVIEWER_OVERLOAD(func, ...) \
66  CLOUDVIEWER_CONCAT(func, CLOUDVIEWER_NUM_ARGS(__VA_ARGS__))