You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Greg Mann (JIRA)" <ji...@apache.org> on 2016/05/27 09:31:12 UTC

[jira] [Created] (MESOS-5471) Enable `Option` to handle string literals gracefully

Greg Mann created MESOS-5471:
--------------------------------

             Summary: Enable `Option` to handle string literals gracefully
                 Key: MESOS-5471
                 URL: https://issues.apache.org/jira/browse/MESOS-5471
             Project: Mesos
          Issue Type: Improvement
            Reporter: Greg Mann


In {{FlagsBase::add}}, MESOS-5064 begins making use of template function parameters like {{T2*}} for the default flag value rather than {{Option<T2>&}}. This is because in some places in the code base, we pass string literals for this argument. If an {{Option}} type is used, the compiler infers a {{char [x]}} type for {{T2}}, which breaks {{Option::getOrElse}}, which attempts to return that same type, since returning arrays is disallowed.

To fix this, we could employ {{std::decay}}, which would convert a return type of {{char [x]}} into {{const char *}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)