Template <typename ... Args>

template
struct pick_first;

template
struct pick_first
{
using type = T;
};

template
using pick_first_t = typename pick_first::type;

template
struct deduce_first_parameter
{
private:
template
struct extract_function;

template
struct extract_function
{
using type = typename Operation::type;
};

template
struct extract_function
{
using type = typename Operation::type;
};

template
using extract_function_t = typename extract_function::type;

public:
using type = extract_function_t;
};

template
struct deduce_first_parameter
{
using type = pick_first_t;
};

Attached: Z.jpg (400x400, 11K)

Can I get a quick rundown on what the fuck is going on here?

Given any callable, deduces the first parameter in the parameter list of the function

#include
#include

struct dummy
{
void operator()(std::vector&) {}
using correct_answer = std::vector&;
};

struct not_so_dummy
{
using correct_answer = const std::vector&;
void operator()(const std::vector&) {}

};

void f(char, int);

int main()
{
static_assert(std::is_same::value);
static_assert(std::is_same::value);
static_assert(std::is_same::value);
}

so this is like... C++ version of pattern matching on lists?

If you're too much of a brainlet to understand such a simple metalanguage then maybe you should leave programming to the Indians and women.

BEAUTIFUL

>2018
>being confused by template templates
what's difficult to understand

Gimme a break dude, no one needs to know this stuff outside of a few niche areas.

>metaprogramming is "niche"
yeah man fuck lisp what a piece of shit language no one ever accompished anything by writing that

The hilarious part is that, if something is wrong in this, the error message would be way less readable than some macro expansion error.

>If you're too much of a brainlet to understand why macros/full compile time execution would have been an infinitely better solution for C++ than "advanced" template metaprogramming, metaclasses etc. combined then maybe you should leave the C++ standard cumittee.
FTFY

this but unironically

use constexpr
t. brainlet

etc. included constexpr

>why compile time execution would have been a better solution than a bunch of other things including compile time execution
??????

constexpr isn't really compile time execution, just const reduction

How do I attain such fearsome job security?

what said
If it can't obsolete external build systems like it does in Jai/Common Lisp it's not good enough.
That said isn't exactly wrong, because rarely anybody these days knows what good metaprogramming facilities look like.

>the error message would be way less readable than some macro expansion error.
I just fucked around with compiling that code trying to get one of these ridiculous error messages (I've seen what you're on about), and I discovered something even worse: no error messages at all because the mistake is still valid code (but it won't do what you want).

I would say "Classic C++" but that's even worse.

it is in c++17

>If it can't obsolete external build systems
you don't want this, all you're doing is slowing down compile times and bloating the executable because you can't be assed to learn a build system

C++ is a good language if you want to write hundreds of lines of nonsense without doing any actual computations.

Some argue that powerful abstractions make languages better, but this only the case if used by skilled developers who know what they are doing with the abstractions and how to use them effectively. C++ is the maximalist example of this.

Java is a great example of how retards ruin abstractions. Most OOP class hierarchies are some of the worst most pointless shit there is because developers are too fucking dumb to know how to use them effectively and how to pick the most minimally abstract solution.

Rob Pike was actually right about Go, because forcing dumb people to use less abstraction leads to better more maintainable codebases than retards using high levels of abstraction.

Jai proves you wrong. The compile time code doesn't end up in the executable and the additional time required is easily matched by the shitty scripting language that all build systems for C++ use.

>it is in c++17
Okay, it can only evaluate some more pure expressions now. Still far from powerful enough in particular for what you pay in return.
>inb4 muh pure reproducible builds
If that was actually a concern - which it isn't - you could always have a pure switch.

>Jai
this is vaporware
>The compile time code doesn't end up in the executable
no but the O(n^2) amount of memory you allocated for compile-time output will and it will also probably crash your build eventually, i don't think i need to explain why this is a bad idea. continuing work on large C++ projects is about reducing build times, not adding to them
>reproducible builds aren't a concern
i would really hate to be trying to test whatever software it is you're shipping

Study C++ metaprogramming