Skip to content

[C++] C++14 laundry list #28552

Description

@asfimport

Improvements to make/be aware of once C++14 is available:

  • Ensure that lambda closure members are moved into where ever possible/appropriate. We have a lot of local variables whose only function is getting copied into a closure, including some demotions to shared_ptr since move only types can't be closed over in c++11
  • visitor pattern can be used more fluidly with template lambdas, for example we could have a utility like
    VisitInts(offset_width, offset_bytes, [&](auto* offsets) { /*mutate offsets*/ })
    to replace a switch statement like
    switch (offset_width) {
    case8:
    /* mutate offsets<int8_t> */break;
    case16:
    /* mutate offsets<int16_t> */break;
    // ...
    }
  • deduced return type with auto:
    template <typename Container>
    autoGetBeginAndEnd(const Container& cont) {
    returnstd::make_pair(cont.begin(), cont.end());
    }
  • constexpr switch, for use in type traits functions
  • std::enable_if_t
  • std::quoted is available for escaping strings
  • std::make_unique
  • standard [[deprecated]] attribute
  • temporal literals such as ""s, ""ns, ...
  • binary literals with place markers such as 0b1100_1111

Reporter: Ben Kietzman / @bkietz

Related issues:

Note: This issue was originally created as ARROW-12816. Please see the migration documentation for further details.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions