Skip to main content
8 votes
Accepted

Stack Interview Code methods made from class Node and Smart Pointers

Overall Not sure I agree with the use of std::unique_ptr inside of Node. BUT I can't really argue against it. So I am not going ...
Loki Astari's user avatar
  • 97.7k
6 votes

Stack Interview Code methods made from class Node and Smart Pointers

swap does not swap sizes. If pop_back throws on empty stack, top shall also throw. I see no ...
vnp's user avatar
  • 58.7k
5 votes
Accepted

Python Export Decorator

Personally, I'd prefer to use @export() or @export(globals()), rather than manually perform the ...
Peilonrayz's user avatar
  • 44.6k
4 votes

"Sudo Mode" in VBA to Let UDFs Modify Workbook

I think this is a neat trick which can have some uses so many thanks to @Greg (the OP) for sharing. One use already identified by the OP in another post is the ability to add named ranges from a UDF ...
Cristian Buse's user avatar
4 votes

"Sudo Mode" in VBA to Let UDFs Modify Workbook

An alternative This post is primarily about how one can get around the limitation of formulae being unable to modify areas outside of themselves. Is there a particular reason that this has to be done ...
Sancarn's user avatar
  • 229
3 votes

Stack Interview Code methods made from class Node and Smart Pointers

...
Snowhawk's user avatar
  • 6,770
3 votes
Accepted

Frame hack to get variable names as strings

Disclaimer: I am not quite sure this can be considered as a proper review but this is definitly too big for a comment. Not all variables are in f_locals Not all ...
SylvainD's user avatar
  • 29.8k
2 votes

Python Export Decorator

If there's too much magic, I worry about static linters and new users not understanding the code, so I would want to support proper global variable assignment. On the other hand, Peilonrayz's answer ...
Aaron Hall's user avatar
  • 1,568
2 votes

Defining hardware components structure

I'll expand a bit on your design by introducing an adapter. Implementation Firstly, you have somewhere an implementation. This could be a library from the internet that you don't want or can't change. ...
Bas Visscher's user avatar
1 vote
Accepted

Defining hardware components structure

Namespace vs. struct It's great that you created a namespace, that already avoids some of the problems global variables have. However, a struct has some advantages, and it's rather trivial to go from ...
G. Sliepen's user avatar
  • 69.3k
1 vote
Accepted

Compute pairwise Pearson's R in parallel with tasks separated by pairs of columns of an array

If you are not going to write anything to X (which it seems you are not doing), and just going to read from it, you should be good to just have all processes access ...
Miguel Alorda's user avatar
1 vote

C++ Data-Oriented Modules using namespaces and extern

I find your approach of using a namespace instead of a class a good fit for for your purpose. I recently started to use it as an alternative to the standard singleton pattern. Regarding the global ...
bassfault's user avatar
  • 335
1 vote

C++ Linked list with smart pointers

In addition to what @MartinYork said, I have a few comments. std::unique_ptr<typename Node<T>::Node> head; Why don't you just say: ...
Captain Hatteras's user avatar
1 vote

Conversion between enum and string in C++ class header

If you have large enumerations, you might find that linear search in an array is inefficient. There's also a real risk of accidentally omitting one or more of the mappings. I solved this a different ...
Toby Speight's user avatar
  • 88.3k

Only top scored, non community-wiki answers of a minimum length are eligible