umbrello: test/import/cxx/cxx11-alternative-function-syntax.h Source File

umbrello 2.32.0 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

cxx11-alternative-function-syntax.h
Go to the documentation of this file.
1 // https://en.wikipedia.org/wiki/C%2B%2B11#Alternative_function_syntax
2
3 // #1
4 template<class Lhs, class Rhs>
5 auto adding_func(const Lhs &lhs, const Rhs &rhs) -> decltype(lhs+rhs) {return lhs + rhs;}
6
7 // #2
8 struct SomeStruct {
9 auto func_name(int x, int y) -> int;
10 };
11
12 auto SomeStruct::func_name(int x, int y) -> int {
13 return x + y;
14 }
adding_func
auto adding_func(const Lhs &lhs, const Rhs &rhs) -> decltype(lhs+rhs)
Definition: cxx11-alternative-function-syntax.h:5
x
int x
Definition: cxx11-lambda-functions-and-expressions.h:4
int
int int y int
Definition: cxx11-lambda-functions-and-expressions.h:4
SomeStruct
Definition: cxx11-alternative-function-syntax.h:8
SomeStruct::func_name
auto func_name(int x, int y) -> int
Definition: cxx11-alternative-function-syntax.h:12