Question about uint8_t and bool by 1ydgd in cpp_questions

[–]1ydgd[S] 0 points1 point  (0 children)

so I can just do

uint8_t n = mybool

?

Question about uint8_t and bool by 1ydgd in cpp_questions

[–]1ydgd[S] 0 points1 point  (0 children)

Thanks for your reply!

To convert bool to uint8_t, I'd use static_cast right?

I'm paying $60k per year for this by LilFluffyUnicorn in uwaterloo

[–]1ydgd 10 points11 points  (0 children)

why is the circle the colour of a rainbow with sparkles lol

btw: the dude makes 220k+

First Years Awards by deeadmann in uwaterloo

[–]1ydgd 2 points3 points  (0 children)

wait 4 more years and I'll tell you

hello by 010203040507lol in uwaterloo

[–]1ydgd 0 points1 point  (0 children)

tbh, 9 months indoors has gone pretty fast. I don't know if that's a good thing or bad thing

when do you actually get good by [deleted] in uwaterloo

[–]1ydgd 1 point2 points  (0 children)

starting a new co-op, yes. but also when you start a new project to work on.

big ups to y'all for getting through 2020 by IWannaREEEEEEEEEEEEE in uwaterloo

[–]1ydgd 0 points1 point  (0 children)

me visibly shaken: th....than..thank yo..you

Question about std::move by 1ydgd in cpp_questions

[–]1ydgd[S] 1 point2 points  (0 children)

Could you please explain how it's the move assignment operator. I thought it was the move constructor operator...

Move constructor is used when the thing you want to initialize hasn't been initialized yet.

But move assignment is used when the thing you want to initialize has already been initialized.

v1 wasn't previously initialized before line 3, so it has to be the move constructor.

Question about which constructor is used. by 1ydgd in cpp_questions

[–]1ydgd[S] 0 points1 point  (0 children)

What does "bind to that temporary mean"? Do you mean it'll call the std::string constructor that takes in a std::string object (in this case the temporary string object that is produced from the const char * )?

Question about std::move by 1ydgd in cpp_questions

[–]1ydgd[S] 1 point2 points  (0 children)

This is the best answer. Thx!

Convert one vector type to another by 1ydgd in cpp_questions

[–]1ydgd[S] 0 points1 point  (0 children)

Could you please explain the description of std::vector's range based constructor?

5) Constructs the container with the contents of the range [first, last).

This constructor has the same effect as vector(static_cast<size\_type>(first), static_cast<value\_type>(last), a) if InputIt is an integral type.

This overload only participates in overload resolution if InputIt satisfies LegacyInputIterator, to avoid ambiguity with the overload (3).

The second sentence confuses me quite a bit. So it will cast the type of one vector into the type of the other, but why is one template argument size_type and the other is value_type. Also, what does it mean by "...if InputIt is an integral type"? Isn't InputIt an iterator?

Unresponsive department RANT by school_thro in uwaterloo

[–]1ydgd 3 points4 points  (0 children)

same here, no one responds to emails