Someone asked me today about how to use a generated header as a C++ dependency in Bazel, so I figured I’d write up a quick example. Create a BUILD file with a genrule that generates the header and a cc_library that wraps it, say, foo/BUILD: genrule( name = “header-gen”, outs = [“my-header.h”], # This commandContinue reading “Using a generated header file as a dependecy”
Tag Archives: c++
Smart Pointers and Heirloom Underpants
I’ve seen a lot of descriptions of scoped_ptr and unique_ptr, but often they don’t give clear examples of when to use one vs. the other. Hopefully this will clear things up. unique_ptr is like an heirloom ring: you might purchase it, have it all your life, and end up being buried with it. For example,Continue reading “Smart Pointers and Heirloom Underpants”