C++11 in glibmm

I haven’t had much chance to play with C++11, though I’m supposed to be a C++ expert. It’s just hard to use it in a project when not every platform has the compiler support. However, with gcc making such progress on C++11 support, it feels like my projects (glibmm, gtkmm, glom) could switch to C++ only some time soon.

So I’m playing with some of the most obvious new features in the glibmm example code, in a branch. Here are some little commits to demonstrate:

2 thoughts on “C++11 in glibmm

  1. For the auto thing, I think you should be able to use decltype:

    decltype(som_method_throwing_an_exception) var;

    try {
    var = some_method_throwing_an_exception(…);
    } catch (….)

    I didn’t try it, but I think it might be worth trying.
    It’s not as bried as using “auto” and assign directly, though.

    1. Thanks. I can see how using decltype(the_function_i_will_use_in_the_try) is useful for generic template code, but it doesn’t seem to make the code much nicer in normal code.

Comments are closed.