Skip to content

Latest commit

 

History

History
107 lines (82 loc) · 2.39 KB

c++0x.markdown

File metadata and controls

107 lines (82 loc) · 2.39 KB

Target Compilers

Available Features in C++11

Language

ICE in GCC 4.4

template <typename T>
T r(T x) { return x; }

template <typename F, typename... T>
inline auto f(F&& f, T&&... x) -> decltype(r(f)(x...)) { return f(x...); }

int g(int);

decltype(f(&g, 123)) x;

Bug in GCC

  • using
    • Fixed in GCC 4.7
template <typename D>
struct A { typedef int x; };

template <typename D>
struct B : A<B<D>> {
    using typename A<B<D>>::x;
    x f() { return 1; }
};

Library

  • <type_traits>

Unavailable Language Features in C++11

Language

  • Template aliases
  • Inheriting constructors
  • Delegating constructors
  • nullptr
    • Emulated by MGBASE_NULLPTR
  • Alignment support
    • Use MGBASE_ALIGNOF
  • Explicit virtual overrides
    • Use MGBASE_OVERRIDE
  • Template arguments with internal linkage
    • DR 1155
    • Do not use locally-defined classes as template parameters

Library

Coding Rules

  • Uniform initialization syntax
    • Zero argument
      • Always use {}
    • One reference
      • Use () for the old versions of GCC
    • One argument, not reference
      • Use () if we expect normal constructors
      • Use {} if we expect initializer_list<>
    • Multiple arguments
      • Use () if we expect normal constructors
      • Use {} if we expect initializer_list<>
    • Omitting return type
      • Use if the constructed type is aggregate