Skip to content

farnyser/cpp-sharpener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C++ sharpener

Mini project aiming to add some C# flavor to C++ !

Example

Build a lambda C# style:

auto square = x => x * x;
std::cout << square(2) << std::endl; // output "4"

Simple named function:

int foobar() => 42;

Null-coalescing operator:

int a = 0;
std::cout << a ?? 3 << std::endl; // output "3" 

Null-conditional operator:

struct foo { auto bar() => "hello !"; };
std::shared_ptr<foo> a = nullptr;
std::cout << (a?->bar() ?? "null") << std::endl; // output "null"

Build & Usage

g++ -std=c++14 sharpener.cpp -o sharpener
cat examples/example.cpp | ./sharpener | g++ -xc++ -std=c++14 -o example -
./example

Releases

No releases published

Packages

No packages published

Languages