Productive Boredom

So I found myself with an awful lot of time on my hands today, away from home, and with no idea what to spend it on at first. I could program my synthesizer, but programming something like that on 4 hours of sleep is a bad idea in my book. Speaking of books, I could read one, but I didn't have anything with me that interested me.

Then I thought back to my drop-in CIS tutoring days, and thought "My goodness, all those numeric menus that everyone has to make are so unbelievably clunky and bulky, even in the advanced classes. I wonder if I couldn't make something to drastically simplify it."

So I spent a little bit of time writing a header to just do that. I thought I'd share my work here, and leave it up for grabs if anyone wants it. Note that you'll need a compiler with some C++11 support. g++ 4.6.3 works like a charm.

Header: http://pastebin.com/vcsP05Wd
Documentation: http://pastebin.com/M0gFuiwk
Example: http://pastebin.com/zh0P0F5y

If anyone else has any stories where their boredom lead them to do something interesting, share them here!

-Albatross
menopause? You have an interesting sense of humor.

Also, I've never thought of using templated pointers, cool.

Edit: wrt boredom, I'm working on a new GUI for an application that my company develops. They seem to feel that the GUI which was developed in 1993 is sufficient, but I think something a little sexier would really sell. When complete, I'm hoping to sell it to them. It'll use Qt instead of a linux-specific application and will use QSS style sheets to make the "look" of it just right and yet also customizable.
Last edited on
@ Albatross: Are you familiar with the term dysorthographia? Or are you just having fun at our expense? The templated function pointers are a good idea, but why didn't you make "exec()" return the type from "action()"?
The templated function pointer seemed rather strange to me. Why not just use a function? Since that's how you're treating it...

1
2
3
4
5
6
7
8
class MenuItem : public MenuBase
{
  //...
  typedef std::function<void()> T;  // <- no need for template

protected:
  T action;
};
@Computergeek01: ...and why do you think I'd want to do that?

@Disch: Because I'm eeeevil. :P
Actually, because it was a bit of an experiment to see how well I could code with templates on that amount of sleep. Yes, using std::function is the obvious and far superior solution.

-Albatross
Topic archived. No new replies allowed.