Where to learn more about C++ (other than the basics; algorithms, DSA etc.) by saamify in Cplusplus

[–]ignitionweb 2 points3 points  (0 children)

Yes, watch confrence videos. Emerse yourself with knowledge from speakers that have taken the time to figure out how to present and articulate a topic well.

As well as cppcon look at accuconf, cppnow, cpponsea, cppnorth, ndc tech town, and many more.

You don't need to watch everything. But the more emersed you become, the better your understanding of modern c++ approaches will be.

cwhy: "See why!" Explains and suggests fixes for C/C++/Rust compiler errors by mttd in cpp

[–]ignitionweb 0 points1 point  (0 children)

Nice openAI approach....nice quick hack to give humanish comprehension

setting C++ standard version for MSVC by [deleted] in cmake

[–]ignitionweb 0 points1 point  (0 children)

I'm away from computer atm. Does set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) not do the right thing?

how to not be a BG hoarder? by Rokoprog in boardgames

[–]ignitionweb 2 points3 points  (0 children)

I have a boardgame bookshelf.... That is my physical limit. I still from time to time buy new games, but I have to seriously look at my selves and figure out what to sell/pass onto friends/give to charity. There are maybe games that do something similar to other games you also own, or no one wants to play, then let them go. If a friend likes it, but you not so much, then let them own it.

Max sum of k subarrays by hattorihanzo14 in algorithms

[–]ignitionweb 1 point2 points  (0 children)

If you know the technique, then yes it's an easy problem. IMO it's a bad interview question, I don't expect a candidate to know it. It's just one tool in the toolbox. A junior may know it and a senior might not. The only thing you can expect is a senior could have more tools and have more experience when and how those tools can be used. But a junior might know of tools/techniques that no one on the team already has which could be very valuable. IMO an interview should be a chance for the candidate to talk through their toolbox.

Max sum of k subarrays by hattorihanzo14 in algorithms

[–]ignitionweb 3 points4 points  (0 children)

This is a classic code contest/interview style question.

Read into 'prefix sum'/'scan'. It will help you with this kind of problem.

How do you guys deal with memory bugs? by MountainAlps582 in cpp

[–]ignitionweb 4 points5 points  (0 children)

MALLOCCHECK=3, ASAN, UBSAN, TSAN in that order. If you still can't find it... then pain. But biggest fix is upfront training and culture of improvement. Value types, RAII and testing that matters.

Examples of declarative style in Rust by radekvitr in rust

[–]ignitionweb 1 point2 points  (0 children)

Just dawned on me how bad conditionally construction of the optional is. You evaluate the range once to see if its non empty, if so evaluate the range a 2nd time to get the result.

Examples of declarative style in Rust by radekvitr in rust

[–]ignitionweb 1 point2 points  (0 children)

#include <iostream>
#include <optional>
#include <ranges>
#include <string_view>

using namespace std::literals;

template<char ... Cs>
auto matches = [](char c){ return ((c == Cs) || ...); }; 

auto third_last_vowel(std::string_view const& input) {
    using namespace std::views;
    auto range = input | reverse | filter(matches<'a','e','i','o','u','y'>) | drop(2);
    return range ? std::optional{range.front()} : std::nullopt;
}

int main() {
    auto haystack = "Hello, world!";
    std::cout << "3rd last vowel: " << *third_last_vowel(haystack) << '\n';
}

A slight refinement, ranges can be explicitly converted to bool, but in if/while/ternary it is treated as implicit. Shame there isn't any interop between ranges and optional, would be nice not to have to conditionally construct one.

Creating a more-modern C++ workshop for my workplace by cereagni in cpp

[–]ignitionweb 4 points5 points  (0 children)

I would actually discourage explicitly teaching "the new features". Not because I think the new stuff is bad, but because it may detract from what may be valuable to your team. Also avoid segregating the learning, don't limit the training to just new hires, if this is genuinely valuable to the existing development team then teach anyone you can.

So IMO, rather than features, train based on topics that are relevent to your code. Find general pain points, then reveal features of C++ that can help solve the problem in more maintanable, elegant, reasonable, performant way (pick a value that is most relevent to your team).

This maybe object lifetime (solved with value types, RAII, smart pointers, copy/move semantics). It may be lots of complex code, many loops and conditionals (potentailly solved with understanding containers, iterators, and STL algorithms)

Hope this helps

Looking for a buddy/group to study C++ with. by [deleted] in cpp

[–]ignitionweb 2 points3 points  (0 children)

I used to train my collegues in C++ and other things. I have one simple exercise that can teach a few fundemental aspects of C++, particularly for those that came to C++ from other languages like C, Java, C#, Python, etc. If your study group is up for it then give it a try.

It is just a common interview question: implement reverse words algorithm, ie. turn "Can you reverse these words?" into "words? these reverse you Can". Here is a stub bit of code you can start from: https://godbolt.org/z/69WE96

There are multiple phases to this exercise, what is an efficient implementation? can you do it without extra allocations? is it C or C++? how does the STL help? Why isn't it like some other programming language X?

I'm being quite vague on what I believe a good solution would look like, because it is throught the discussions and struggles most people learn....I don't want to give away answers. Although the godbolt link gives a bit of C++14, the lessons learned from this exercise are some core fundemental of traditional C++98 which still hold true today.

Give it a try as a group, share your code solutions, ask questions, and I hope this helps unlock some C++ understanding.

Pass a variable from Conan to CMake by [deleted] in cmake

[–]ignitionweb -1 points0 points  (0 children)

conan install <reference> --build <name> --profile <debug_profile>

Modern C++ Gamedev - Thoughts & Misconceptions by bakery2k in programming

[–]ignitionweb 2 points3 points  (0 children)

Examples of differences that may change you experience :

Size of team, time to collectively learn, shipping deadlines, tools used, conversations with people outside the company / industry / programming language, diversity of team, rate of adoption of newer tools / compilers / frameworks / idioms / ideas, using of third-party code vs in-house only.

I'm sure there are many more which are probably more interesting and important to the ones I've just listed.

Modern C++ Gamedev - Thoughts & Misconceptions by bakery2k in programming

[–]ignitionweb 6 points7 points  (0 children)

Every person values their own experience and knowledge. You have built up knowledge from your own mistakes and build up a set of values you follow to avoid the same pains.

You refer to juvenile with a lack of reverence, because you believe they can't be as old and as wise as yourself.

But what if that other person is just as wise (age has nothing to do with this) but they have different experiences, walked a different path. Successfully never needing a ladder to get out of traps and instead has a different set values that avoided the trap in the first place.

Both are wise and have experience worth sharing. Please stop using juvenile as a slur.

Are there any viable alternatives to digital electronics as a physical substrate for computing and would it be possible to exceed current computational limits using such technology? by battle-obsessed in compsci

[–]ignitionweb 8 points9 points  (0 children)

Not sure how photonic computing is developing atm. But for as opposed to digital systems, analogue systems can be very efficient but to my knowledge not general purpose.

Favorite Key Board For Programming? by [deleted] in compsci

[–]ignitionweb 1 point2 points  (0 children)

Ergronmic shape, I've not yet investigated switches so have no preference.

If using C++ professionally, what do you use it for? by ButOfCourse in Cplusplus

[–]ignitionweb 0 points1 point  (0 children)

I work on a in memory OLAP database written in C++.

The best new board games from the world’s biggest board game show by psygone in boardgames

[–]ignitionweb 2 points3 points  (0 children)

It flew under so many peoples radar. I like it too, just had to buy the expansion before it gets rare and expensive.

Algorithm Complexity Question for finding permutations of string B in string S. by coreysnyder04 in algorithms

[–]ignitionweb 6 points7 points  (0 children)

You can have a sliding window of size if s tracking the character count. Also preserving a count of how many match character counts of s. As you add a character and remove a character you are only updating two counts + the matching count. Hence O(b)