comp.lang.c++@googlegroups.com | Google Groups | ![]() |
Unsure why you received this message? You previously subscribed to digests from this group, but we haven't been sending them for a while. We fixed that, but if you don't want to get these messages, send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
- C++ tests/testing - 2 Updates
- Is it OK to OCCASIONALLY submit C++ code for comments in this group, like RFC? - 2 Updates
- Deleting std::vector Item(s) - 1 Update
scott@slp53.sl.home (Scott Lurndal): Sep 26 07:18PM >>Indeed. Asking about language features or STL is pretty silly; [...] >I find value in asking about such things. For one, I don't want to >hire a C++ programmer that is adding code that is full of C-isms[1]. Misguided attempt at language purity. >I want a C++ programmer that understands const and references and >RAII, among other things. I want programmers that can solve problems effiently and effectively. I don't particularly care whether they use "pure C++" (in fact, I have no problem with using C-isms in C++ programs (e.g. snprintf instead of i/o streams). In several of the projects I've hired for, STL wasn't even allowed (bare-metal C++ code). There is much benefit in "C + Classes"-style of C++. As much as the C++14 purists, if not much, much more. |
Christopher Pisz <nospam@notanaddress.com>: Sep 26 02:49PM -0500 On 9/26/2014 9:17 AM, Robert Hutchings wrote: > will calculate some value or perhaps store and retrieve data. > I'd be interested to hear what kind of tests or interview questions you > use to qualify candidates... It really depends what you are looking for. I don't think there is one be all test. It is usually a bit catered to the domain we are working on rather than just the language itself. Example: Write me a method to convert a position on a 600X800 screen to the same position on a 1600X1080 screen. If you get stuck, explain your reasoning. There are also those questions that you don't expect anyone to get when you are looking for someone more senior Example: What is the initialization fiasco? If you just need a grunt medium level C++ guy, just ask the standard virtual, pure virtual, inheritance, exceptions questions. Then there are question to weed out the C guys applying for C++ positions (but I have a certain hatred for them): Example: Write me a struct,... why do you need that typedef? How would you perform error handling here? What are your thoughts on this global pointer in this dll? Write this to file...you don't like fstream? what is a stream? How would you do logging in this scenario? Write me some stubs...why do you have variable argument lists? |
woodbrian77@gmail.com: Sep 26 12:28PM -0700 On Friday, September 26, 2014 1:52:15 PM UTC-5, Robert Hutchings wrote: > Unfortunately, my current employer does NOT "do" code reviews (!). > This would only be an occasional thing, and I am very receptive to > constructive criticism.... I've been doing that for years. No one complains about it. I've gotten a lot of good advice from this newsgroup. Brian Ebenezer Enteprises - Heavenly code. http://webEbenezer.net |
Christopher Pisz <nospam@notanaddress.com>: Sep 26 02:33PM -0500 On 9/26/2014 1:51 PM, Robert Hutchings wrote: > This would only be an occasional thing, and I am very receptive to > constructive criticism.... > -> Rob Hutchings Just be aware that if you do not post full compilable working examples, you are likely to just get responses telling you to do so. Noone is going to bother going through the code when it is in production form with tons of references that aren't listed. But if you post in the form, here is what I want to do, here are the needed classes and here is my test driver, then you'll probably get good feedback. |
peter koch <peter.koch.larsen@gmail.com>: Sep 26 07:22AM -0700 Den onsdag den 24. september 2014 18.43.00 UTC+2 skrev Jorgen Grahn: > defVect.erase(end, defVect.end()); > In either case, I too warmly recommend the "move, then erase" approach. > /Jorgen You can't do that as you do not know what is between end and defVect.end(). My solution was a 3-liner: auto end = std::stable_partition(defVect.begin(), defVect.end(), deletePredicate); std::for_each(end, defVect.end(),[](xx val) {delete val;}); defVect.erase(end,defVect.end()); Ike had a two-liner solution - something like: auto end = std::remove_if(defVect.begin(), defVect.end(), [](xx val) { if (deletePredicate(val) { delete val; return true;}; return false; }); defVect.erase(end, defVect.end()); This solution is perhaps better than mine. It is just that it to me smells a little that I delete in the predicate. Perhaps you overlooked that the vector consisted of raw pointers that had to be deleted? /Peter |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment