NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

#define PORT 2
#define GLUER(x,y,z) x##y##z
#define PxDIR(x) GLUER(P,x,DIR)

//#define DECS(...) __VA_ARGS__;

// Make a FOREACH macro
#define FE_1(WHAT, X) WHAT(X)
#define FE_2(WHAT, X, ...) WHAT(X)FE_1(WHAT, __VA_ARGS__)
#define FE_3(WHAT, X, ...) WHAT(X)FE_2(WHAT, __VA_ARGS__)
#define FE_4(WHAT, X, ...) WHAT(X)FE_3(WHAT, __VA_ARGS__)
#define FE_5(WHAT, X, ...) WHAT(X)FE_4(WHAT, __VA_ARGS__)
//... repeat as needed

#define GET_MACRO(_1,_2,_3,_4,_5,NAME,...) NAME
#define FOR_EACH(action,...)
GET_MACRO(__VA_ARGS__,FE_5,FE_4,FE_3,FE_2,FE_1)(action,__VA_ARGS__)


#define STRUCT_MEM(name) char *name;
#define DEF_STRUCT(name, ...) extern const struct name {
FOR_EACH(STRUCT_MEM, __VA_ARGS__)
};

DEF_STRUCT(myStruct, a = "first",
b = "second",
c = "third")


#define CAT(x, y) CAT_(x, y)
#define CAT_(x, y) x ## y

//#define STM(expr) CAT(x, __COUNTER__){expr}; DEC(DEC(__COUNTER__)); f(CAT(x, __COUNTER__)); ;

#define EXECUTOR executor
#define STM(expr) STM_(CAT(x, __COUNTER__), expr)
#define STM_(var, expr) auto var = expr; EXECUTOR.f(var); ;
#define DECS(...) FOR_EACH(STM, __VA_ARGS__) EXECUTOR.spin()

#define ENS(name, ...) __VA_ARGS__ CAT(name, N)


int main() {
DECS(1, 2)
ENS(x, 8, 9)
PxDIR(PORT) |= 0x01;
return 0;
}


################################################################
##################################################################


// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <variant>
#include <functional>
#include <tuple>
#include <concepts>

using namespace std;

int f(int x, int y=3, int z=7) {
return x + y + z;
}

/*
template <typename F>
requires std::invocable<F>
void f(F callback);
*/

template <class F, typename Ret, class... Args >
concept Callable = std::invocable<F, Args...> && std::same_as<Ret, std::invoke_result_t<F, Args...>>;

//template <class F, typename Ret, class... Args >
//auto Co<F, Ret(Args...)> = Callable<F, Ret, Args...>;

template<Callable<int, int, int, int> TF>
//template<std::Callable<int(int, int, int)> TF>
//template<typename TF>
int ff(TF&& f) {
return f(1, 2, 3);
}

int main()
{
typedef const bool* BoolCondition;
typedef function<bool()> CallableCondition;
auto vr = variant<int, string>(32);
auto vr2 = variant<BoolCondition, CallableCondition>{};

vr2 = []{ return true;};
int xx = 4;
auto y = [x = get<CallableCondition>(vr2)]()
{
//r += 2;
return x() * x() ;
}();
std::cout << "Hello, Wandbox!" << y << std::endl;

auto t = make_tuple(1, string("abc"), 3.7);

apply([](const auto&... x){ (..., (x+x)); }, t);

cout<< f(0, 3, 5) <<endl;
cout<< ff(f) <<endl;

auto vv{vector<int>{1, 11}};

cout<< vv[1] <<endl;
}

// GCC reference:
// https://gcc.gnu.org/

// C++ language references:
// https://cppreference.com/
// https://isocpp.org/
// http://www.open-std.org/jtc1/sc22/wg21/

// Boost libraries references:
// https://www.boost.org/doc/
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.