← Home ← Back to /g/

Thread 106981872

23 posts 4 images /g/
Anonymous No.106981872 [Report] >>106981901 >>106982643 >>106982649 >>106982775 >>106983032 >>106984240 >>106984551
>sfinae
What was his endgame?
Anonymous No.106981901 [Report]
>>106981872 (OP)
>endgame
to sell his 1000+ page textbooks
Anonymous No.106982643 [Report]
>>106981872 (OP)
Sauce? Can't say I recall seeing Bjarne in a suit before.
Anonymous No.106982649 [Report] >>106982734
>>106981872 (OP)
making a very sharp knife that 99% of people will cut themselves. pretty good for the remaining 1% though
Anonymous No.106982669 [Report]
It wouldn't make sense for a template declaration to cause a compiler error when it's not the template you want to use, makes perfect sense. It was given a name because you can overfload this feature as a customization point is called meta programming
Anonymous No.106982734 [Report] >>106982787 >>106983022 >>106983031 >>106988137
>>106982649
Based. 99% of the "people" shouldn't swim in dangerous waters desu to be honest.
#include <iostream>

// This overload is added to the set of overloads if C is
// a class or reference-to-class type and F is a pointer to member function of C
template<class C, class F>
auto test(C c, F f) -> decltype((void)(c.*f)(), void())
{
std::cout << "(1) Class/class reference overload called\n";
}

// This overload is added to the set of overloads if C is a
// pointer-to-class type and F is a pointer to member function of C
template<class C, class F>
auto test(C c, F f) -> decltype((void)((c->*f)()), void())
{
std::cout << "(2) Pointer overload called\n";
}

// This overload is always in the set of overloads: ellipsis
// parameter has the lowest ranking for overload resolution
void test(...)
{
std::cout << "(3) Catch-all overload called\n";
}

int main()
{
struct X { void f() {} };
X x;
X& rx = x;
test(x, &X::f); // (1)
test(rx, &X::f); // (1), creates a copy of x
test(&x, &X::f); // (2)
test(42, 1337); // (3)
}
Anonymous No.106982775 [Report]
>>106981872 (OP)
He looks very nice :)

Substitution Failure Is Not An Error (SFINAE)
I think he means stuff like when a struct is null, that you should program it in a way that it won't crash the program, so the program may continue working.

His endgame would be just good programming design and versatility.
Anonymous No.106982787 [Report] >>106982845 >>106984256
>>106982734
The 1% use like 50% of the language which they very carefully selected so that they don't get hit by footguns. The thing about C++ is that it has so many features (and yet it's still missing stuff like reflection...) that it's inevitable that some of them will interact in a catastrophic way if you're not careful.
Anonymous No.106982805 [Report]
I might not know what I'm talking about, but I do like C++
Anonymous No.106982845 [Report] >>106983037
>>106982787
I don't consider this fact different than any other form of engineering. A race mechanic properly chooses his tools and coordinates carefully with his team members during raceday to avoid "footguns". In the hands of skilled craftsmen, sharp tools can create beauty.

Troons are brats about such things because they just don't measure up. Simple as.
int f1(int);
int f2(float);

struct A
{
using fp1 = int(*)(int);
operator fp1() { return f1; } // conversion function to pointer to function
using fp2 = int(*)(float);
operator fp2() { return f2; } // conversion function to pointer to function
} a;

int i = a(1); // calls f1 via pointer returned from conversion function
Anonymous No.106983022 [Report] >>106984055
>>106982734
Which is better? static_if or if constexpr?
Anonymous No.106983031 [Report]
>>106982734
Intentionally pouring poison into waters and telling people they are retarded for not wanting to swim in them is not very bright.
Anonymous No.106983032 [Report]
>>106981872 (OP)
He'sfinae spit some rhymes
Anonymous No.106983037 [Report] >>106984055
>>106982845
What problem does this sharp tool solve?
Anonymous No.106984055 [Report] >>106985079
>>106983022
static_if is simpler to use (and therefore likely "better", so-called). OTOH, if constexpr addresses the same need, and has the BIG advantage of being actual C++.

>>106983037
int i = a(1);

Being able to call this deterministically at compile time with no runtime overhead is both powerful, elegant, & flexible.
Anonymous No.106984240 [Report]
>>106981872 (OP)
C, but with classes, and he didn't want to maintain it all by himself.
Anonymous No.106984256 [Report] >>106984525
>>106982787
Never the same 50%
Anonymous No.106984525 [Report]
>>106984256
>all problems in the entire world of technical complexity are exactly the same at all times.
Anon, I...
Anonymous No.106984551 [Report] >>106985087
>>106981872 (OP)
did you learn the word "endgame" last week or something?
and what is its connection to this nocoder?
Anonymous No.106985079 [Report] >>106986250
>>106984055
Jesus Christ.
Anonymous No.106985087 [Report] >>106986250
>>106984551
Dunno man, he created Sepples and its insanity.
Anonymous No.106986250 [Report]
>>106985079
Is Lord of all? True enough.

>>106985087
Certainly if his agenda was to spark "BDS" in troons, then he succeeded quite nicely by all appearances.
Anonymous No.106988137 [Report]
>>106982734
this is so fucking retarded
who even writes stuff like that
show me a serious c++ project on github with that kind of bs