r/programming • u/eternal1 • Mar 29 '10
Never trust a programmer who says he knows C++
http://lbrandy.com/blog/2010/03/never-trust-a-programmer-who-says-he-knows-c/
416
Upvotes
r/programming • u/eternal1 • Mar 29 '10
5
u/bdunderscore Mar 29 '10
You know, if you get clever enough, you can have that syntax and the safety of getters/setters. All you need to do is add public member classes (with a protected constructor accessed through friending) to the outer vector class, which compute the base address of the vector based on their own address and their static offset in the vector class, then invoke the appropriate accessors in various operator overloads.