Changeset 182254 in webkit


Ignore:
Timestamp:
Apr 1, 2015 2:01:24 PM (9 years ago)
Author:
Antti Koivisto
Message:

015-04-01 Antti Koivisto <Antti Koivisto>

Value assignment operator of Optional should be stricter
https://bugs.webkit.org/show_bug.cgi?id=143303

Reviewed by Andreas Kling.

struct Foo { mutable Optional<std::chrono::seconds> s; };
Foo foo, foo2;
foo = foo2;

doesn't build because it tries to use wrong operator=.

  • wtf/Optional.h:

Add enable_if test similar to std::experimental::optional.

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r182243 r182254  
     1015-04-01  Antti Koivisto  <antti@apple.com>
     2
     3        Value assignment operator of Optional should be stricter
     4        https://bugs.webkit.org/show_bug.cgi?id=143303
     5
     6        Reviewed by Andreas Kling.
     7
     8        struct Foo { mutable Optional<std::chrono::seconds> s; };
     9        Foo foo, foo2;
     10        foo = foo2;
     11
     12        doesn't build because it tries to use wrong operator=.
     13
     14        * wtf/Optional.h:
     15
     16            Add enable_if test similar to std::experimental::optional.
     17
    1182015-04-01  Alex Christensen  <achristensen@webkit.org>
    219
  • trunk/Source/WTF/wtf/Optional.h

    r181398 r182254  
    123123    }
    124124
    125     template<typename U>
     125    template<typename U, class = typename std::enable_if<std::is_same<typename std::remove_reference<U>::type, T>::value>::type>
    126126    Optional& operator=(U&& u)
    127127    {
Note: See TracChangeset for help on using the changeset viewer.