Changeset 140857 in webkit
- Timestamp:
- Jan 25, 2013 12:18:58 PM (11 years ago)
- Location:
- trunk/Source/WTF
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r140731 r140857 1 2013-01-25 Eric Seidel <eric@webkit.org> 2 3 Support 4 and 5 argument bound static functions 4 https://bugs.webkit.org/show_bug.cgi?id=107973 5 6 Reviewed by Anders Carlsson. 7 8 Yummy copy/paste template code! 9 I'm about to use this in a BackgroundHTMLParser patch, but figured this should be landed separately. 10 11 * wtf/Functional.h: 12 (WTF): 13 (WTF::R): 14 1 15 2013-01-24 Martin Robinson <mrobinson@igalia.com> 2 16 -
trunk/Source/WTF/wtf/Functional.h
r140589 r140857 79 79 class FunctionWrapper; 80 80 81 // Bound static functions: 82 81 83 template<typename R> 82 84 class FunctionWrapper<R (*)()> { … … 158 160 R (*m_function)(P1, P2, P3); 159 161 }; 162 163 template<typename R, typename P1, typename P2, typename P3, typename P4> 164 class FunctionWrapper<R (*)(P1, P2, P3, P4)> { 165 public: 166 typedef R ResultType; 167 static const bool shouldRefFirstParameter = false; 168 169 explicit FunctionWrapper(R (*function)(P1, P2, P3, P4)) 170 : m_function(function) 171 { 172 } 173 174 R operator()(P1 p1, P2 p2, P3 p3, P4 p4) 175 { 176 return m_function(p1, p2, p3, p4); 177 } 178 179 private: 180 R (*m_function)(P1, P2, P3, P4); 181 }; 182 183 template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5> 184 class FunctionWrapper<R (*)(P1, P2, P3, P4, P5)> { 185 public: 186 typedef R ResultType; 187 static const bool shouldRefFirstParameter = false; 188 189 explicit FunctionWrapper(R (*function)(P1, P2, P3, P4, P5)) 190 : m_function(function) 191 { 192 } 193 194 R operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) 195 { 196 return m_function(p1, p2, p3, p4, p5); 197 } 198 199 private: 200 R (*m_function)(P1, P2, P3, P4, P5); 201 }; 202 203 // Bound member functions: 160 204 161 205 template<typename R, typename C>
Note: See TracChangeset
for help on using the changeset viewer.