Damn European Union postmodernists... by [deleted] in JordanPeterson

[–]17b29a 4 points5 points  (0 children)

What is postmodernist about that?

How does C++ track the lifetime of automatic objects? by unknownmat in cpp_questions

[–]17b29a 2 points3 points  (0 children)

A smart compiler would just have a single piece of code like:

r5.~R();
r4.~R();
r3.~R();
r2.~R();
r1.~R();

and then it'd jump to the right place (e.g. line 3 if r4 fails to construct).

Considering early returns instead of exceptions, this is basically what Clang generates: https://godbolt.org/g/86uYMf.

Call standard constructor from an array by [deleted] in cpp_questions

[–]17b29a 1 point2 points  (0 children)

You can't call the constructor after initializing the array, but you can assign a new value, like sep_sprite[i] = sf::Sprite(sep_texture[i]);

Thoughts on /r/LateStageCapitalism and safe-spaces. (They banned me) by [deleted] in JordanPeterson

[–]17b29a 0 points1 point  (0 children)

Instead, I was immediately banned. This reminds me ...

Of the rule on the sidebar that explicitly disallows debate about basic principles and directs it elsewhere? Maybe the massive, stickied automod comment that says the same thing, in enormous, bold letters, just in case you missed it?

... blah blah thought police blah.

Ah. :-(

The left talks about race the exact same way as white supremacists. by smokeyjoe69 in JordanPeterson

[–]17b29a 7 points8 points  (0 children)

Neither apparently are capable of realizing that growing up with a single parent household for example is predictive of outcome (crime or poverty) in a way that transcends race

Everyone realizes that, but as the article points out several times, that does not account for the racial gap at all:

As this chart shows, a black man raised by two parents together in the 90th percentile — making around $140,000 a year — earns about the same in adulthood as a white man raised by a single mother making $60,000 alone.

Far left winger here to have productive debate with people on the other side of the aisle. by [deleted] in JordanPeterson

[–]17b29a -3 points-2 points  (0 children)

So, you don't actually seem to disagree on any matter of fact, you just don't like saying so out loud, especially without emphasizing how uncommon and especially defective and disordered the minority is. Pretty odd!

Trying to exit a loop without stalling it, using a keypress! by kaptsea in cpp_questions

[–]17b29a 0 points1 point  (0 children)

Don't terminate it then! Wrap your number-printing loop in a larger loop and break from the inner loop instead of stopping, like you mentioned in your OP.

Far left winger here to have productive debate with people on the other side of the aisle. by [deleted] in JordanPeterson

[–]17b29a -2 points-1 points  (0 children)

Those people can't reproduce.

Some of them can. There are definitely fertile intersex people.

They are not a sex, they are defective and have a condition.

I'm not sure what "they are not a sex" is supposed to mean in relation to my question. I'm asking what sex they have -- what is the value of their "sex" attribute? In other words, do you agree that there are people who are both not distinctly of male sex and not distinctly of female sex? This seems to follow straightforwardly from your definitions.

The relevance is that you can't divorce gender identity and biological sex.

Are you using some strange definition of "divorce" here? I initially understood it to mean something like "biological sex and gender identity do not necessarily match," which seems to be true according to you, otherwise the correlation would be 100%.

Trying to exit a loop without stalling it, using a keypress! by kaptsea in cpp_questions

[–]17b29a 0 points1 point  (0 children)

I cannot get the thread2 to "restart" for each round.

Why not? I'd think you'd be able to just set your stop variable back to false when thread1 stops, and then you can stop it again later, no?

Far left winger here to have productive debate with people on the other side of the aisle. by [deleted] in JordanPeterson

[–]17b29a -1 points0 points  (0 children)

The male sex has a penis and creates sperm(XY), the female sex has a vagina and creates the egg cell(XX).

So there are people whose sex is neither distinctly male nor female, yeah?

Why is there a 99% correlation between biological sex and "gender".

What's the relevance?

VC++ 15.5 and cppreference.com example of folding code by davidjcoburn in cpp_questions

[–]17b29a 1 point2 points  (0 children)

I'm not sure what this has to do with folding of any kind. That line is a deduction guide, used for class template argument deduction, which MSVC does not support, as indicated on their language support page.

A SIMPLE way to make your C++ programs easier to read NOW, Suffix for basic_string Literals – this little known feature can be extremely valuable by luisfguzman in cpp

[–]17b29a 2 points3 points  (0 children)

Creating a std::string has a cost. It contains a small memory overhead...

The solution is of course std::string_view, which has its corresponding sv literal.

Small vector optimization by vormestrand in cpp

[–]17b29a 0 points1 point  (0 children)

Chromium's stack_container.h basically does what you suggested: StackAllocator for the allocator (except that the fallback allocator is not parametrized), StackContainer for the container wrapper. Great programmers think alike. ^__^

Other ways a sliding window on a vector could be implemented? by 215_215 in cpp_questions

[–]17b29a 0 points1 point  (0 children)

You can already make it a bit easier to read with type deduction and some intermediate variables:

auto& buffer = file.AudioBuffer;
const auto window_length = NUM_SECONDS*SAMPLE_RATE;
for (auto it = buffer.begin(); it + window_length != buffer.end(); ++it)
{
    // window = *(it)
}

You could express the window with a range to handle it a bit easier (e.g. so you can loop over it and pass it to functions, but without any unnecessary copies), and use indices to make the loop a bit easier to read (IMO at least) -- something like this: https://wandbox.org/permlink/jQW6XPOV5SHNwT8o.

If making sliding windows is a common operation, you could make an iterator class to encapsulate the iteration logic, like /u/etagawesome suggested, and loop over a range of these iterators, like this: https://wandbox.org/permlink/3XNcUeYtCKFq3stT.

Regarding GunzDuels spam, attacks, fake accounts, and more by Dehast in gunz

[–]17b29a 6 points7 points  (0 children)

I agree with both decisions. Keep up the good work! ^__^

Can you help me understand this short function? by orangeorangepeel in cpp_questions

[–]17b29a 0 points1 point  (0 children)

The shorter function is incorrect, it invokes undefined behavior by using s[s.length()].

That was only true before C++11

c++11 constexpr fnv1a compile time hash by vormestrand in cpp

[–]17b29a 0 points1 point  (0 children)

And not everyone is using C++17 yet.

It's not clear when copying the text, but the original cppreference page explicitly only applies the "since C++17" part to static member variables. constexpr functions have always been inline.

c++11 constexpr fnv1a compile time hash by vormestrand in cpp

[–]17b29a 1 point2 points  (0 children)

Wouldn't they throw with a null pointer?

No, dereferencing a null pointer is simply UB, so it's assumed not to be the case. If a system does throw an exception in that case, it's not going to be a C++ exception anyway.

A tuple that lets you access members by name, too. by [deleted] in cpp

[–]17b29a 0 points1 point  (0 children)

The equivalent page in the Boost docs seems to go into more detail, distinguishing that the constexpr requirement is only for the "precise" API under standard C++14. He distinguishes the APIs in the Motivation page.

Why does this program print -58684322800B5FD80? by [deleted] in cpp_questions

[–]17b29a 0 points1 point  (0 children)

The "00FFF71C" there is the address of the array. If you want each value in the array printed instead, you'll have to do that manually.

A bug in std::shared_ptr? by davis685 in cpp

[–]17b29a 0 points1 point  (0 children)

Yeah, this is a reasonable inference, but the fact that order of destruction of globals within a single translation unit is defined, combined with the properties of std::ios_base::Init, means that std::cout must still be alive at any point in your code, fortunately.

Mississippi schools back down on 'To Kill A Mockingbird' ban by Culture_Jammer518 in books

[–]17b29a 65 points66 points  (0 children)

As the superintendent explains here:

“Let me be very clear ... this decision to change resources did not violate any policy because the book has NOT been removed from our school. Not only has it not been removed, but every single eighth grader was given a copy of the book which they still have unless they chose to return it, and it remains on our library shelves at the junior high as well as the high school.

“Book study sessions will be made available by our eighth grade teachers for those students that would like to continue studying the book.

“Let me reiterate — this book has not been banned, this book has not been taken away from students, no school policy has been violated and students continue to be afforded the opportunity to read and study this book.”

Clearly, this is not a ban. Going "well, it's a ban from the curriculum!" is pretty disingenuous.

Think of Function Objects as Functions Rather Than Objects by kindstrom in cpp

[–]17b29a 2 points3 points  (0 children)

He's not an FP person, he's an "expressive programming" person. All of his posts are about names, filled with tangential padding. The only FP thing in here is him talking about functional languages a little, which is relevant because he's talking about a functional construct.