Jump to content
  • Advertisement

bmadden

Member
  • Content Count

    11
  • Joined

  • Last visited

Community Reputation

110 Neutral

About bmadden

  • Rank
    Member
  1. Yea. The item in Scott Meyer's book is the reason I asked this question. He explains that the universal reference approach is uniquely optimal vs the alternatives (pass by value, as in your example, or overloaded constructors for rvalues and lvalues). The performance gain is real, barring compiler optimizations, which are not something I'm concerned with right now.   He lays out arguments for and against each choice but leaves the question of which to use, and when to use it, open ended. Hence my deliberation. Perhaps this is one of the situations where pass by value might be right. Maybe even overloading the constructor for rvalues and lvalues is a good idea. This example is contrived, but that's fine for a thought exercise.
  2. Okay, I didn't contextualize that comment previously, but I think this definitely pushes this into the overkill category for the 1 arg constructor case. While I believe I could avoid this issue using expression SFINAE or a copy constructor with a targetted prototype, both solutions feel like they are trying to justify something that is simply not valuable enough to justify.   That being said, the implicitly generated assignment operator still works (not necessarily a good enough solution, but something to keep in mind in certain cases). Also, this problem is less potent for move-only objects.   I can't think of similar issues with multiple argument constructors, but, considering I didn't think of this issue in the first place, I might be missing something.   I don't want to abandon this paradigm solely because there are times when it may be costly and, therefore, not the right thing to do. Instead, I hope to become more aware of the set of potential issues with doing this. I do think that it offers some valuable, low cost efficiency gains in a lot of situations. Do you disagree with that?   Side note: the amount of errors in my tiny sample is embarassing (what() should return what_arg_.c_str() or something).
  3.   Yea, I realized that last night when reading SiCrane's most recent comment. That was a mistake. My question was about universal references, which the sample code does not contain. It should really look like this: class SocketError : public std::exception {     public:     template<typename T>         SocketError(T&& what_arg)             : what_arg_(std::forward<T>(what_arg)) { }         virtual const char* what() const noexcept override {             std::cout << what_arg_;         }     private:         std::string what_arg_;     }; That being said, even with the acute drawbacks mentioned by SiCrane, I'm still convinced that this is a good idea in a significant majority of cases. I sincerely appreciate SiCrane's noting of some niche cases, and I will have to continue learning about similar cases so that I can avoid them in practice. If anyone has any additional information to add, I'd love to hear it.
  4.   These are valid concerns that I will take seriously. On a strictly idealistic level, in terms of runtime performance, these are nonissues (with the exception of the point about primitive types), right?   I see these concerns as motivation to design my debugging system in a way to reduce nonsense error messages, rather than motivation to not use perfect forwarded constructors.
  5. Always is a strong word. Let's say "most of the time" instead
  6. Can someone give me a convincing argument against always using a templated constructor that perfect forwards its arguments to initialize its member variables?   In the very simple example case:     template<typename T>     class SocketError : public std::exception {     public:         SocketError(T&& what_arg)             : what_arg_(std::forward<T>(what_arg)) { }         virtual const char* what() const noexcept override {             std::cout << what_arg_;         }     private:         std::string what_arg_;     }; A more complicated case might use a variadic template or multiple universal reference constructor arguments.   I'm finding it hard to convince myself that this is a bad idea, so if anyone would like to enlighten me, please do.   Downsides I'm aware of: Potentially increased size of the object code Debugging can be a bitch   I'm aware that certain compiler optimizations may make this less valuable, but let's generalize here.
  7. bmadden

    Substantial project

      So in terms of the poker stats tool, a lot of my inspiration derives from hold'em indicator (http://holdemindicator.com/). While the actual meat of the project might be relatively small compared to the other options, the additional features built around it would definitely add some depth. For example, a plugin interface for using it with different online poker clients, player history, for sites that have deanonymized players (ie: Bovada does not uniquely identify players at a table), and a "hand replayer" that maintains historical data about a table that the user is playing at. The AI/machine learning side of things would certainly add a huge amount of depth to the project, but perhaps too much for my initial timeline.   I do see this project as potentially less valuable than the others (without the bot element) since a lot of it would focus on tooling after the statistics engine is out of the way.
  8.   This book is seriously amazing. If you are rusty on your C++98 skills, go through Effective C++ by Scott Meyers first. Follow that up with Effective Modern C++, and you will be in a really good place. I can't recommend Effective Modern C++ enough, though. It is possibly the most succinct programming reference/book I've ever come accross.
  9. bmadden

    Substantial project

    Considering that I'm not trying to make any great strides in game development with this project :P, I'm leaning towards something resembling a dungeon crawler. There are a few reasons why I think this might be the right direction. First, I just like that genre. Second, managing the state of a dungeon crawler is a much more interesting problem then, say, a puzzle game. This would force me to think about the interaction of multiple elements (combat, positioning, world state) and how to properly process this information together in each cycle.   I've also already made a (notably terrible) dungeon crawler game in the past. I could leverage that experience with my improved general software engineering and C++ skills to make something I'm happy with. Additionally, if I did decide to do this on mobile, I could happily do it in 2d, which would help keep the project manageable as a signle developer who wants to see reasonable results in a period of about 6-9 months.   I also have friends who have expressed interest in doing art for me if I choose to make a game involving monsters or demons of some sort (that's just the kind of art they want to do).   A longer term goal (I'm trying really hard not to have too many grand aspirations since I mostly just want to make something that works in a reasonable amount of time) would be to have multiplayer co op, which would allow me to exercise my network programming muscles as well. This would round out the project quite nicely.   I'm not set on the dungeon crawler idea, but this is where my thoughts have led me so far.
  10. bmadden

    Substantial project

    Side note: I've been a lurker for a long time, but now that I've made an account, I will likely become more involved on these forums :)
  11. Hi guys, I'm a senior in college (graduating in December), and I have some decently interesting projects on my GitHub. Thus far, my projects have been relatively small, with one notable exception from a year ago where I designed a working small scale CDN. I also have 6 months of professional C++ and python development experience doing financial engineering.   Anyway, I'm looking to add something else to my portfolio. I've narrowed it down to three projects, and I'm having trouble deciding between them. What I'm looking to get out of this is experience with a larger project, fun, and something to put on my GitHub/resume. I enjoy lots of different areas of programming, but I probably prefer systems/networks type stuff above all. Graphics is a close contender as well.   Enough of the background. The project ideas I've narrowed my search to are:  - a Web server, which would support http (no tls), compression, threaded or process based request handling, and possibly a plugin interface    - a game (likely desktop, but possibly mobile). I would be making the game with a custom engine. I'm aware of the challenge presented here, but the goal would not be to have high quality graphics or gameplay. It would strictly be an exercise in developing a substantial system.    - a poker tool, which would start as a tool for understanding where you stand, statistically, in a given hand. I've thought about developing this idea further into an automated pokerbot, but that would not be the principle focus at this time, especially since the statistical analysis is a prerequisite to the full-fledged bot.   I have most of the requisite knowledge for all three of these projects, with statistical poker analysis being a bit of an exception. I would strongly prefer to do the project in C++ for multiple reasons, but I hope that doesn't have too much influence on any discussion here.   I'm not sure if this is even the right place to be asking about this, but most of my friends have been unwilling to engage me in a discussion about the merits of each project idea.   Any feedback on the pros/cons of the ideas is much appreciated. Hopefully the discussion here will be useful to others in the future as well.   Thanks.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!