CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 4 of 4

Thread: C++17: possibilities and examples

  1. #1
    Join Date
    Mar 2016

    Post C++17: possibilities and examples

    Due to constant С++ extension developers have to be in-the-know and regularly follow all the changes, introduced by the new standard. So, new possibilities and rules have been introduced in C++17. GCC, Clang, Visual Studio compiler developers are already actively adding them.

    One of the developers of PVS-Studio static code analyzer wrote an overview article with the most interesting innovations and also demonstrated them with examples.

    For instance, new logical meta functions std::conjunction, std:: disjunction and std::negation have been introduced. They are used to perform a logical AND, OR, NOT on a set of traits, respectively. Here is also a small example with std::conjunction:

    // C++17
    #include <iostream>
    #include <string>
    #include <algorithm>
    #include <functional>
    template<typename... Args>
    Func(Args... args)
      std::cout << "All types are integral.\n";
    template<typename... Args>
    Func(Args... args)
      std::cout << "Not all types are integral.\n";
    int main()
      Func(42, true); // All types are integral.
      Func(42, "hello"); // Not all types are integral. 
      return 0;

    Besides, the article touches upon such examples, as:

    • Fold expressions
    • template<auto>
    • Class template argument deduction
    • Constexpr if
    • Constexpr lambdas
    • *this capture in lambda expressions
    • inline variables
    • Structured bindings
    • Initializer in 'if' and 'switch'
    • __has_include
    • and many other interesting features

    The full version of the article is available by the link:

  2. #2
    Join Date
    Oct 2019

    Re: C++17: possibilities and examples

    Thanкs a lot. It's a very useful information.

  3. #3
    Join Date
    Sep 2020

    Re: C++17: possibilities and examples

    Very Very Nice Information Thank you

  4. #4

    Re: C++17: possibilities and examples

    Pretty useful information, thanks!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)