|
Ari posted:Disagree. Some of it can be confusing if you're not familiar with either the programming or mathematical concepts involved, but Boost is spread wide over many different ideas, and a lot of the time it just simplifies existing stdlibc++ functionality through syntactic sugar (think boost/foreach.hpp). Parts of Boost is taught in a lot of introductory C++ classes both in high school and college, and for good reason - for the most part, it's good for you. The STL higher-order algorithms in particular are a pain in the rear end without boost::bind.
|
# ? Mar 29, 2010 18:48 |
|
|
# ? Jun 1, 2024 22:00 |
|
Ari posted:Disagree. Some of it can be confusing if you're not familiar with either the programming or mathematical concepts involved, but Boost is spread wide over many different ideas, and a lot of the time it just simplifies existing stdlibc++ functionality through syntactic sugar (think boost/foreach.hpp). Parts of Boost is taught in a lot of introductory C++ classes both in high school and college, and for good reason - for the most part, it's good for you. This is not really a good idea. Using Boost from the start is just a good way of learning C++ by rote. Until you at least conceptually understand templates, you should limit your use of Boost to the absolute minimum. God help you if you mistype anything; your compiler will explode at you. Obviously you don't need to know all the gooey bits, but without a basic understanding of templates, you're forced to rely on memorization and help from other people when you end up with a 200-line template error backtrace. Avenging Dentist fucked around with this message at 18:52 on Mar 29, 2010 |
# ? Mar 29, 2010 18:50 |
|
As someone who uses Boost every day in very large doses and looks at it as probably the greatest collection of generic libraries that exists, I wouldn't recommend it to a newcomer, especially concerning bind, lambda, phoenix, etc. As was pointed out, they are fantastic but many of the libraries involve syntactical dances that would likely seem unintuitive to someone who doesn't have at least a basic understanding of the more subtle rules of C++ and how the libraries work. As AD said, one slight mistake and you may face hundreds/thousands of lines of compile errors that can be difficult for both an inexperienced and an experienced programmer to figure out. I suppose I could pull back my statement a bit and say yes, there are a few Boost libraries that are fine for someone new to the language, but as for the libraries mentioned above and the solution I mentioned in my other post, I think a newcomer to C++, regardless of background, would not have a sufficient understanding of the language to grasp what's going on and would spend too much time battling compile errors and using tools whose specifics are well beyond his comprehension.
|
# ? Mar 29, 2010 20:04 |
|
Are there any free, Windows/Visual Studio buffer overflow detectors?
|
# ? Mar 29, 2010 20:05 |
|
txrandom posted:Are there any free, Windows/Visual Studio buffer overflow detectors? I think that this guy can detect buffer overflows: http://www.microsoft.com/downloads/details.aspx?FamilyID=c4a25ab9-649d-4a1b-b4a7-c9d8b095df18&displaylang=en
|
# ? Mar 29, 2010 20:38 |
|
That Turkey Story posted:As someone who uses Boost every day in very large doses and looks at it as probably the greatest collection of generic libraries that exists, I wouldn't recommend it to a newcomer, especially concerning bind, lambda, phoenix, etc. As was pointed out, they are fantastic but many of the libraries involve syntactical dances that would likely seem unintuitive to someone who doesn't have at least a basic understanding of the more subtle rules of C++ and how the libraries work. As AD said, one slight mistake and you may face hundreds/thousands of lines of compile errors that can be difficult for both an inexperienced and an experienced programmer to figure out. I suppose I could pull back my statement a bit and say yes, there are a few Boost libraries that are fine for someone new to the language, but as for the libraries mentioned above and the solution I mentioned in my other post, I think a newcomer to C++, regardless of background, would not have a sufficient understanding of the language to grasp what's going on and would spend too much time battling compile errors and using tools whose specifics are well beyond his comprehension. Even simple cases of bind?
|
# ? Mar 29, 2010 22:04 |
|
The STL does have bind1st and bind2nd.
|
# ? Mar 29, 2010 22:30 |
|
Plorkyeran posted:The STL does have bind1st and bind2nd. Yeah, and they're much more awkward to use than boost::bind.
|
# ? Mar 29, 2010 22:44 |
|
GrumpyDoctor posted:Even simple cases of bind? Have you seen a compiler error from bind? It's absolutely awful, and even I end up glazing over it.
|
# ? Mar 29, 2010 22:59 |
|
B-but... concepts...
|
# ? Mar 29, 2010 23:21 |
|
Do you guys know about the upcoming improvements to C++ listed here? What do you guys think?
|
# ? Mar 30, 2010 00:18 |
|
They're awesome and fix most of my complaints with the language. I can't wait for a compiler to implement them.
|
# ? Mar 30, 2010 00:31 |
|
floWenoL posted:Do you guys know about the upcoming improvements to C++ listed here? What do you guys think? What's scary is that nr. 1 actually made some degree of sense to me.
|
# ? Mar 30, 2010 01:30 |
|
Nasty template metaprogramming question: Is there any way (either in current C++ or C++0x) through templates to extract the argument types of a function or operator() of a function object? I've got something working in the case of a function with a single argument: code:
Second: Can this be generalized to n-ary functions/function objects, making it possible to extract the type of the i-th argument for some arbitrary i? I just finished reading Elements of Programming and it's got me thinking about stuff like this EDIT: Ah, Boost, of course; I just discovered <boost/function_types/parameter_types.hpp>. Now to see how difficult it would be to pull that functionality out of the rest of Boost, for purely academic purposes... Flobbster fucked around with this message at 02:10 on Mar 30, 2010 |
# ? Mar 30, 2010 01:50 |
|
I've been teaching myself C++, mostly for hobby but also to eventually expand it into my work. I am almost finished with Accelerated C++, and the following link from the OP: http://www.parkscomputing.com/cppwiki/index.php?title=List_of_recommended_books recommends that I buy "Pro Visual C++/CLI and the .NET 2.0 Platform." Well, I know that is pretty old, and I did find a newer version on Amazon for .NET 3.5 (although I believe 4.0 should be out soon...) but I also read the C++ FAQ that is listed in the OP and I feel like maybe I should just skip to the Effective C++ books. I guess I have a few questions: 1. What is the C++/CLI thing? Is that just a Microsoft implementation? Am I limiting myself by learning that, or is that an irrelevant question? If I buy this book and learn the .NET platform is that going to detract from my learning actual C++? I'm on Windows and have been using Visual Studio 2010 beta while working through Accelerated C++. 2. Are there other books that people would recommend instead? I suppose at this point my options are either continue down this list of recommended books, or just buy the C++ Primer and Effective C++ and read/understand those.
|
# ? Mar 30, 2010 02:18 |
|
Flobbster posted:EDIT: Ah, Boost, of course; I just discovered <boost/function_types/parameter_types.hpp>. Now to see how difficult it would be to pull that functionality out of the rest of Boost, for purely academic purposes... Quite easy (let's just do binary C functions that don't return void in C++03): code:
You should be able to generalize this pretty easily, and the C++0x variadic version isn't too hard either.
|
# ? Mar 30, 2010 02:25 |
|
Vomik posted:1. What is the C++/CLI thing? Is that just a Microsoft implementation? Am I limiting myself by learning that, or is that an irrelevant question? If I buy this book and learn the .NET platform is that going to detract from my learning actual C++? I'm on Windows and have been using Visual Studio 2010 beta while working through Accelerated C++. It's C++ with .NET. Obviously this only works when you're using .NET, and I really wouldn't recommend it. Honestly, I should probably put up better recommendations than that link (it's kinda old and sucky). Vomik posted:2. Are there other books that people would recommend instead? I suppose at this point my options are either continue down this list of recommended books, or just buy the C++ Primer and Effective C++ and read/understand those. Effective C++ is probably good. I'm not really the best person to ask since I learned purely by programming in C++ a lot. Honestly, depending on the type of learner you are, that might be the best route.
|
# ? Mar 30, 2010 02:28 |
|
Avenging Dentist posted:Quite easy (let's just do binary C functions that don't return void in C++03): Ah, I had a minor brain fart on the syntax, forgetting that no matter how many parameters I declare in template<...>, I'm only passing the single function pointer type into the instantiation. But in the case of using a function object instead of a function pointer, it looks the only solution is to explicitly have the function object type declare typedefs first_argument_type, second_argument_type, etc., since I can't specialize on the signature of operator() like I can on something like R(*)(A1,A2)?
|
# ? Mar 30, 2010 02:42 |
|
Vomik posted:1. What is the C++/CLI thing? Is that just a Microsoft implementation? Am I limiting myself by learning that, or is that an irrelevant question? If I buy this book and learn the .NET platform is that going to detract from my learning actual C++? I'm on Windows and have been using Visual Studio 2010 beta while working through Accelerated C++. It's a marketing gimmick as far as I can tell. If you want to develop .net applications, you will get the best support by using C# or VB.
|
# ? Mar 30, 2010 03:00 |
|
Flobbster posted:But in the case of using a function object instead of a function pointer, it looks the only solution is to explicitly have the function object type declare typedefs first_argument_type, second_argument_type, etc., since I can't specialize on the signature of operator() like I can on something like R(*)(A1,A2)? You might be able to do it, but it will play havoc with multiple overloads of the call operator.
|
# ? Mar 30, 2010 03:01 |
|
Gazpacho posted:C++/CLI is a dialect of C++ that compiles to the .net platform and has nonstandard features to use some of the features of that platform. The main usage (intended by MS or not) of C++/CLI is mostly when you have a lot of old C++ code laying around and you want to migrate to .Net. I wouldn't say it's a marketing gimmick, you don't really hear MS mention it much.
|
# ? Mar 30, 2010 03:12 |
|
Gazpacho posted:C++/CLI is a dialect of C++ that compiles to the .net platform and has nonstandard features to use some of the features of that platform. Avenging Dentist posted:It's C++ with .NET. Obviously this only works when you're using .NET, and I really wouldn't recommend it. Honestly, I should probably put up better recommendations than that link (it's kinda old and sucky). All right, I think I'm going to skip anything C++/CLI related, and pick up Effective C++ and C++ Primer. Just to double-check I can continue to use Visual Studio for learning regular C++ right? As long as I don't access any of the CLI libraries (or whatever.) Also, you're right Avenging Dentist. I probably should just start actually programming something, but I'm mostly worried about learning bad practices. Maybe I'll start actually working on the things I have as my end-goal anyway.
|
# ? Mar 30, 2010 03:22 |
|
Avenging Dentist's Official Guide to Becoming an Awesome Programmer:
|
# ? Mar 30, 2010 03:30 |
|
Avenging Dentist posted:Avenging Dentist's Official Guide to Becoming an Awesome Programmer: Hint: works best when you have time to fail repeatedly in rapid succession.
|
# ? Mar 30, 2010 04:05 |
|
Effective C++ (and the other ones you should read, effective STL and exceptional C++) aren't much use until you've actually done quite a lot of programming. I guess you can buy them and read them and then understand them in a couple of years
|
# ? Mar 30, 2010 04:14 |
|
niteice posted:Hint: works best when you have time to fail repeatedly in rapid succession.
|
# ? Mar 30, 2010 04:52 |
|
Dijkstracula posted:also if you don't get discouraged by massive failure Saturday-afternoon Special as it sounds, every time I've failed in a project, I've learned an awful lot about design (way more than I've learned from books). It's difficult to learn good design except to get burned by bad designs, but once you've learned it, you can basically do anything.
|
# ? Mar 30, 2010 04:58 |
|
Avenging Dentist posted:Saturday-afternoon Special as it sounds, every time I've failed in a project, I've learned an awful lot about design (way more than I've learned from books). It's difficult to learn good design except to get burned by bad designs, but once you've learned it, you can basically do anything. That's kind of what I like about the effective/exceptional books. They give good, justified solutions to problems which come up pretty often - solutions that aren't easy to get right yourself (for example, the exception safe stack worked-ad-nauseum example). So if you've been programming for a few years, they're good to look through and see alternative solutions to problems you've no doubt come across.
|
# ? Mar 30, 2010 05:04 |
|
Has anyone ever dealt with changing layouts in Qt? I want to change between two different layouts, and they aren't as simple as swapping vertical alignment with horizontal alignment. I have nested layouts with spacers and two widgets I don't want to destroy every time the layout changes. I have pointers to these widgets, but I haven't been able to reparent them successfully. I'd have thought this would be a standard feature for Qt but I've gone through the documentation and searched the mailing lists and can't seem to find a good answer or one that isn't as painful as having to reconstruct all of my widgets every time I want something to change position. Please tell me I'm just missing something obvious.
|
# ? Mar 30, 2010 09:52 |
|
C++ newbie, can anyone tell me why this line:code:
code:
|
# ? Mar 30, 2010 10:01 |
|
Stavros posted:C++ newbie, can anyone tell me why this line: std::vector is a resizable array of objects, not a geometry vector.
|
# ? Mar 30, 2010 10:09 |
|
Contero posted:std::vector is a resizable array of objects, not a geometry vector. Oops you're right. I guess I meant to do proj.push_back(0) instead. Thanks.
|
# ? Mar 30, 2010 10:17 |
|
Contero posted:Has anyone ever dealt with changing layouts in Qt? I want to change between two different layouts, and they aren't as simple as swapping vertical alignment with horizontal alignment. I have nested layouts with spacers and two widgets I don't want to destroy every time the layout changes. I have pointers to these widgets, but I haven't been able to reparent them successfully. QWidget::setLayout says to delete the previous layout (on the container, that is) to be able to set the new one. QLayout::addChildWidget can also move things around layouts, but whines doing that (and is documented as such). Looking around the code suggests that should work.
|
# ? Mar 30, 2010 14:15 |
|
Stavros posted:Oops you're right. I guess I meant to do proj.push_back(0) instead. Thanks.
|
# ? Mar 30, 2010 15:09 |
|
OddObserver posted:QWidget::setLayout says to delete the previous layout (on the container, that is) to be able to set the new one. QLayout::addChildWidget can also move things around layouts, but whines doing that (and is documented as such). Looking around the code suggests that should work. Well deleting a layout deletes all of its children, in this case my widgets that I don't want deleted. I've tried to reparent them to a temporary widget then add them again but I don't think it worked. Maybe I was doing things in the wrong order. I could probably make some sort of smart pointer wrapper around QWidget, but it seems like a bit of a hack to do something that should be in Qt by default.
|
# ? Mar 30, 2010 19:07 |
|
Contero posted:Well deleting a layout deletes all of its children, in this case my widgets that I don't want deleted. quote:I've tried to reparent them to a temporary widget then add them again but I don't think it worked. Maybe I was doing things in the wrong order. Well, moving them to the new layout (adding it to them) may work, but will likely spam the terminal with warnings. I am quite surprised but what you're doing, though, hard to picture what it'd be good for --- all scenarios I can think of can probably be handled by just using a QStackedWidget or something.
|
# ? Mar 30, 2010 19:56 |
|
Stavros posted:C++ newbie, can anyone tell me why this line: If you want to declare an int vector with 3 indices = 0, then vector<int> proj(3,0) will do that... I don't know if that is necessarily the best thing you want to do for your purpose though. In fact, just proj(3) should do it because I think the default value for int is 0.
|
# ? Mar 30, 2010 21:33 |
|
Quick pointers question. Given the following code: code:
- ptrA, ptrB, and ptrC point to NULL values? - ptrA points to ptrB, which points to ptrC, which points to NULL value?
|
# ? Mar 30, 2010 22:10 |
|
Assignment is right-associative, so a = b = c is the same as a = (b = c)
|
# ? Mar 30, 2010 22:13 |
|
|
# ? Jun 1, 2024 22:00 |
|
Ahh that makes sense. I was worried I was doing some really stupid with that line of code. Thanks, chief.
|
# ? Mar 30, 2010 22:18 |