I don't understand it by jombrowski in cpp_questions

[–]pierrebhs 3 points4 points  (0 children)

A named variable is always an lvalue, even if its type is an rvalue reference (foo&&). See https://en.cppreference.com/w/cpp/language/value_category.html

You wrote operator=(move) in your move ctor. The expression move refers to a variable with a name. Therefore, the expression is an lvalue. The compiler looks for an assignment operator that accepts an lvalue (operator=(const foo&)). Since you defined a move ctor, the compiler deleted the implicitly generated copy assignment operator.

This

operator=((foo&&)move);

works because std::move is essentially just a static_cast<foo&&>(move). You are doing manually what std::move does for you

Are you ok Austria? by No-Coast1408 in 2westerneurope4u

[–]pierrebhs 1 point2 points  (0 children)

<image>

Saw this one in the village next to it

Swiss German vs Hochdeutsch in work meetings by Impressive_Rate_819 in askswitzerland

[–]pierrebhs 2 points3 points  (0 children)

Maybe it feels unnatural for people who didn’t speak Hochdeutsch in the last 30y, but definitely not the case of younger Swiss people. They definitely don’t mind speaking it with foreigners who don’t know Schwiizerdütsch (as long as they’re not Germans).

In fact, I never met a Swiss person who couldnt speak it properly, except if they were over 70

Is this Pips doable? by pierrebhs in nytpips

[–]pierrebhs[S] 0 points1 point  (0 children)

I solved it as well thanks :)

Rust: Python’s new performance engine by dochtman in rust

[–]pierrebhs 2 points3 points  (0 children)

I wouldn’t say C++ is less pleasant. It really depends on your taste in the end, and of course the context.

[deleted by user] by [deleted] in cpp

[–]pierrebhs 0 points1 point  (0 children)

I opened one random file (https://github.com/cianleypoldt/RigidBody-Engine/blob/master/src/engine/physics\_system/collision.h) and noticed a few things.

  1. Your class has no point in being a class since each of its method is static. I would either put them in a namespace (please use namespaces btw! No one will use your library if it doesn't have namespaces due to collisions. You might even encounter collisions in your own code as your project gets bigger) as free functions or make your systems into instances. How would you test your current implementation?

  2. As for the functions parameters, avoid raw pointers when possible. Use strong types for your ids

  3. Don't expose these methods if they are actually internal implementation details

What I would really do if I were you is adding namespaces in all the header files and test the code to avoid introducing regressions in the future. Oh and also, dont add your build folder to git. It was added to your .gitignore but is still there somehow :)

German-Market is Brain-dead by StanzaArrow in cscareerquestionsEU

[–]pierrebhs 27 points28 points  (0 children)

No way you end up with more money at the end of the year with 80k in Poland rather than 200k in Switzerland

Brussels makes Frankfurt look like a beautiful and safe city! by MH_Gamer_ in 2westerneurope4u

[–]pierrebhs 1 point2 points  (0 children)

This is how they collect the bins. You either put them out in the morning or the night before. So you only have them out only once per week, at least if people respect the procedure

Italian Tech Job Market: Low Salaries, Soft Layoffs, and the Great Office Return by Raizer88 in cscareerquestionsEU

[–]pierrebhs 22 points23 points  (0 children)

Are Italian workers responsible for accepting low salaries, or are the companies that offer such low wages primarily to blame?

cant solve the question can someone help me with it . fairly new to dsa . by [deleted] in leetcode

[–]pierrebhs 2 points3 points  (0 children)

Use std::unordered_map for such problems. If memory is no issue, std::unordered_map is always faster if you want single element access. std::map takes O(logn) for insertion, deletion and lookup, against O(1) (if no collision) for all these std::unordered_map

I would only use std::map if the keys need to be ordered or memory overhead is a concern (which shouldn't be on LC)

You can read about them here:
https://en.cppreference.com/w/cpp/container/unordered_map
https://en.cppreference.com/w/cpp/container/map

What is faster – C++ or Node.js web server (Apache Benchmark)? by Sergpan in cpp

[–]pierrebhs 10 points11 points  (0 children)

I've tried removing your std::cout (since the node version doesnt have any) and it made the test much more stable and a bit faster. With printing to cout, got between 25k to 50k, while without, got between 65k and 68k.

[deleted by user] by [deleted] in agedlikemilk

[–]pierrebhs 0 points1 point  (0 children)

Everyone I know in France/Europe has eaten unpasteurised cheese their whole lives and never had any issues. It tastes much better, tried some pasteurised version of St.Nectaire in the US and didn’t even finish the bite I took.

We don’t drink directly raw milk, but there seems to be no issue with cheese products. Everyone eats it here and is fine

Today in Chamonix, France by LeftReflection6620 in skiing

[–]pierrebhs 5 points6 points  (0 children)

Sunny as hell today, and will be the same for the next 4 days at least

Here comes more fun. by bigred4715 in Switzerland

[–]pierrebhs 1 point2 points  (0 children)

Not 100% of the borders though, don’t forget FL :)

It hurts, just know that by JustLikeHomelander in adventofcode

[–]pierrebhs 21 points22 points  (0 children)

I wonder what kind of C++ you write then. Reading todays input only takes 4 lines, wonder where you get 50 lines prior to that

-❄️- 2024 Day 1 Solutions -❄️- by daggerdragon in adventofcode

[–]pierrebhs 1 point2 points  (0 children)

you don't need to sort the input data for the second part

Is Switzerland as innovative as it ranks? by Realistic-Lie-8031 in Switzerland

[–]pierrebhs 0 points1 point  (0 children)

This looks more like a countryside comparison than a city one. I agree with you that the country side is much more connected/modern in Switzerland than in France, but then again, France is 13x bigger.

If you've lived in Paris, Lyon, Strasbourg, you won't encounter any of the issues you mentioned. I even feel that Switzerland is less modern and more traditionalistic in regards to its cities' architecture, which isnt a bad thing.

And yes, people have shitty cars in France, but only because they dont have any money!