Bug 140905

Summary: Add match_constness<Reference, T> helper struct
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: Web Template FrameworkAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, benjamin, cmarcelo, commit-queue, darin, kling
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Chris Dumez 2015-01-26 15:09:25 PST
Add match_constness<Reference, T> helper struct to simplify downcast<>() a bit. The purpose of this helper is to update T's constness to match Reference's.
Comment 1 Chris Dumez 2015-01-26 15:10:38 PST
Created attachment 245379 [details]
Patch
Comment 2 Chris Dumez 2015-01-27 20:38:33 PST
ping review?
Comment 3 Benjamin Poulain 2015-01-30 15:28:53 PST
Comment on attachment 245379 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=245379&action=review

> Source/WTF/wtf/TypeCasts.h:72
> +    typedef typename std::conditional<std::is_const<Reference>::value, typename std::add_const<T>::type, typename std::remove_const<T>::type>::type type;

The last type should be Type.
Comment 4 Chris Dumez 2015-01-30 15:31:21 PST
Comment on attachment 245379 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=245379&action=review

>> Source/WTF/wtf/TypeCasts.h:72
>> +    typedef typename std::conditional<std::is_const<Reference>::value, typename std::add_const<T>::type, typename std::remove_const<T>::type>::type type;
> 
> The last type should be Type.

I kinda like the consistency with STL here.
Comment 5 Chris Dumez 2015-01-30 15:31:57 PST
Comment on attachment 245379 [details]
Patch

Clearing flags on attachment: 245379

Committed r179416: <http://trac.webkit.org/changeset/179416>
Comment 6 Chris Dumez 2015-01-30 15:32:02 PST
All reviewed patches have been landed.  Closing bug.