[MDEV-18620] use std::tuple to return several values from function Created: 2019-02-18  Updated: 2019-02-18  Resolved: 2019-02-18

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Fix Version/s: 10.4.3

Type: Task Priority: Minor
Reporter: Eugene Kosov (Inactive) Assignee: Eugene Kosov (Inactive)
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

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



 Comments   
Comment by Marko Mäkelä [ 2019-02-18 ]

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};

Comment by Eugene Kosov (Inactive) [ 2019-02-18 ]

Can't be done with all supported compilers.

Generated at Thu Feb 08 08:45:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.