cppx-core
macro-with.hpp
Go to the documentation of this file.
1 #pragma once // Source encoding: UTF-8 with BOM (π is a lowercase Greek "pi").
2 
5 
6 #ifndef CPPX_NO_DOLLARS_PLEASE
7 # define $with CPPX_WITH
8 # define $with_const CPPX_WITH_CONST
9 #endif
10 
11 #ifdef _MSC_VER
12 # pragma warning( disable: 4127 ) // Sillywarning "conditional expression is constant".
13 #endif
14 
24 
25 #define CPPX_WITH( ... ) \
26  if ( auto&& _ [[maybe_unused]] = __VA_ARGS__; true )
27 
32 #define CPPX_WITH_CONST( ... ) \
33  if( const auto& _ [[maybe_unused]] = __VA_ARGS__; true )