-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlambda.h
More file actions
36 lines (29 loc) · 1.03 KB
/
Copy pathlambda.h
File metadata and controls
36 lines (29 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
//
/////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __HAS_CPPMACROS_LAMBDA_H__
#define __HAS_CPPMACROS_LAMBDA_H__
/*! \file lambda.h
\brief Macros for short write lambdas
Depend from:
- /common/versions.h
*/
#include <macroslib.h>
#include "../common/versions.h"
#ifdef CXX11
# define LAMBDA_0
# define LAMBDA_1(ret) []() { return ( ret ); }
# define LAMBDA_2(arg, ret) [] arg { return ( ret ); }
# define LAMBDA_3(scope, arg, ret) scope arg { return ( ret ); }
/*!
\brief [C++11 and greater] Construct lambda function
\param scope [optional, if 3 arguments (scope, arg, ret)] argument passing type in square brackets
\param arg [optional, if 2 arguments (arg, ret)] arguments block in parentheses
\param ret return value expression
\returns noexcept if supported
*/
# define LAMBDA(...) PP_VA_FUNC(LAMBDA, __VA_ARGS__)
#endif // C++11
/////////////////////////////////////////////////////////////////////////////
#endif // __HAS_CPPMACROS_LAMBDA_H__