How do I initialize classes with lots of fields in an elegant way?

You can either use a constructor or a builder pattern or a variation of the builder pattern to fix the problem of having too many fields in your initialization step. I’m going to extend your example a bit to prove my point of why these options are useful. Understanding your example: Lets say an Offer … Read more

How to call a function by its name (std::string) in C++?

What you have described is called reflection and C++ doesn’t support it. However you might come with some work-around, for example in this very concrete case you might use an std::map that would map names of functions (std::string objects) to function pointers, which in case of functions with the very same prototype could be easier … Read more

Indenting preprocessor directives with clang-format

As of version 6.0, the option IndentPPDirectives can be used. Usage is described in this review. Using IndentPPDirectives: None results in: #if FOO #if BAR #include <foo> #endif #endif While IndentPPDirectives: AfterHash gives: #if FOO # if BAR # include <foo> # endif #endif Edit: see @Gabriel Staples’ answer for details on the BeforeHash option … Read more

Clean react native project

A react-native Project is about one XCode Project and one Android Project. (for pure js code, there’s no need to do clean) So, what you need would be Clean XCode Project with cd ios xcodebuild clean And then clean Android Project with cd android ./gradlew clean You can simply write a batch file for it.

Is there a script to list git branches created by me?

This command lists all branches and their author names git for-each-ref –format=” %(authorname) %09 %(refname)” –sort=authorname If you are using github you can also visit https://github.com/author/repo/branches/yours to get all your branches If you want to just delete all the already merged branches you can us the command git branch –merged | grep -v “\*” | … Read more

tech