Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-18620

use std::tuple to return several values from function

Details

    Description

      For ease of code read use std::tuple + std::tie. Also test that every 10.4 compiler support this stuff.

      Attachments

        Activity

          Unfortunately, the submitted patch does not work with our current selection of compilers. Here is an example:

          /opt/buildbot-slave/mariadb/starfsmenn1/build/storage/innobase/handler/handler0alter.cc: In function 'std::tuple<long unsigned int, long unsigned int, long unsigned int> get_type(const Field&)':
          /opt/buildbot-slave/mariadb/starfsmenn1/build/storage/innobase/handler/handler0alter.cc:9013:28: error: converting to 'std::tuple<long unsigned int, long unsigned int, long unsigned int>' from initializer list would use explicit constructor 'constexpr std::tuple< <template-parameter-1-1> >::tuple(_UElements&& ...) [with _UElements = {long unsigned int&, long unsigned int&, long unsigned int&}; <template-parameter-2-2> = void; _Elements = {long unsigned int, long unsigned int, long unsigned int}]'
            return {prtype, mtype, len};
          

          marko Marko Mäkelä added a comment - Unfortunately, the submitted patch does not work with our current selection of compilers. Here is an example : /opt/buildbot-slave/mariadb/starfsmenn1/build/storage/innobase/handler/handler0alter.cc: In function 'std::tuple<long unsigned int, long unsigned int, long unsigned int> get_type(const Field&)': /opt/buildbot-slave/mariadb/starfsmenn1/build/storage/innobase/handler/handler0alter.cc:9013:28: error: converting to 'std::tuple<long unsigned int, long unsigned int, long unsigned int>' from initializer list would use explicit constructor 'constexpr std::tuple< <template-parameter-1-1> >::tuple(_UElements&& ...) [with _UElements = {long unsigned int&, long unsigned int&, long unsigned int&}; <template-parameter-2-2> = void; _Elements = {long unsigned int, long unsigned int, long unsigned int}]' return {prtype, mtype, len};

          Can't be done with all supported compilers.

          kevg Eugene Kosov (Inactive) added a comment - Can't be done with all supported compilers.

          People

            kevg Eugene Kosov (Inactive)
            kevg Eugene Kosov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.