‘Head First’ Style Data Structures & Algorithms Book? [closed]

The Algorithm Design Manual by Steve Skiena isn’t exactly a barrel of laughs, but it’s relatively light on the deeper mathematics and contains lots of what he calls “War Stories”, which are illustrative examples from real world situations where algorithm work really paid off (or, sometimes, totally failed). He’s also got his audio and video … Read more

Benefits of using reference_wrapper instead of raw pointer in containers?

I don’t think there is any technical difference. Reference wrapper provides basic pointer functionality, including the ability to change the target dynamically. One benefit is that it demonstrates intent. It tells people who read the code that “whoever” has the variable, isn’t actually controlling its lifespan. The user hasn’t forgotten to delete or new anything, … Read more

Include with FromSqlRaw and stored procedure in EF Core 3.1

Shortly, you can’t do that (at least for SqlServer). The explanation is contained in EF Core documentation – Raw SQL Queries – Composing with LINQ: Composing with LINQ requires your raw SQL query to be composable since EF Core will treat the supplied SQL as a subquery. SQL queries that can be composed on begin … Read more

Can I make Json.net deserialize a C# 9 record type with the “primary” constructor, as if it had [JsonConstructor]?

Firstly, you only have to do this when you create your own constructors. This is due to the fact that on instantiation it won’t know which one to use. Secondly, note that (by default) the deserializer will use the property and constructor names and overwrite the ones you omit in the actual constructor type. Furthermore, … Read more

How to add libraries in C++?

This would probably interest you, but here is a short version: When you assemble the .cpp, .c or whatever files, each translation unit (that is, each file) generates an object file. When creating the final executable, you combine all the object files into a single binary. For static libraries, you compile the static archive (.a … Read more

CMake install (TARGETS in subdirectories)

According to this bugreport, install(TARGETS) command flow accepts only targets created within the same directory. So you need either move the add_library() call into the top-level directory, or split install(TARGETS) call into per-target ones, and move each of them into the corresponding subdirectory. Since CMake 3.13 install(TARGETS) can work even with targets created in other … Read more