Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Issue 2381793004: Add Sk version of std::exchange (Closed)

Created:
4 years, 2 months ago by csmartdalton
Modified:
4 years, 2 months ago
CC:
reviews_skia.org
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Patch Set 1 #

Patch Set 2 : Add Sk version of std::exchange #

Patch Set 3 : skstd #

Total comments: 7

Patch Set 4 : Add Sk version of std::exchange #

Unified diffs Side-by-side diffs Delta from patch set Stats (+25 lines, -0 lines) Patch
A src/core/SkExchange.h View 1 2 3 1 chunk +25 lines, -0 lines 0 comments Download

Messages

Total messages: 20 (7 generated)
csmartdalton
I want to use this CL to start a discussion about doing this kind of ...
4 years, 2 months ago (2016-09-29 17:04:21 UTC) #3
mtklein_C
Usually we put these things in namespace skstd, otherwise identical to the future std:: function ...
4 years, 2 months ago (2016-09-29 17:08:29 UTC) #5
csmartdalton
Like this, in its own file?
4 years, 2 months ago (2016-09-29 18:06:09 UTC) #7
mtklein_C
https://codereview.chromium.org/2381793004/diff/40001/src/core/SkExchange.h File src/core/SkExchange.h (right): https://codereview.chromium.org/2381793004/diff/40001/src/core/SkExchange.h#newcode14 src/core/SkExchange.h:14: template <typename T, typename U> inline T exchange(T& obj, ...
4 years, 2 months ago (2016-09-29 18:11:02 UTC) #9
csmartdalton
BTW, what would you think of making an skstd/ subdirectory for stuff like this? It ...
4 years, 2 months ago (2016-09-29 19:19:22 UTC) #10
mtklein_C
Moving things around to make an skstd/ subdirectory sounds like make-work to me. What's the ...
4 years, 2 months ago (2016-09-29 19:36:39 UTC) #11
csmartdalton
On 2016/09/29 19:36:39, mtklein_C wrote: > Moving things around to make an skstd/ subdirectory sounds ...
4 years, 2 months ago (2016-09-29 19:42:26 UTC) #12
mtklein_C
On 2016/09/29 at 19:42:26, csmartdalton wrote: > On 2016/09/29 19:36:39, mtklein_C wrote: > > Moving ...
4 years, 2 months ago (2016-09-29 19:46:11 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2381793004/60001
4 years, 2 months ago (2016-09-29 19:51:42 UTC) #15
reed1
is this a replacement for SkTSwap? Can it be?
4 years, 2 months ago (2016-09-29 20:01:33 UTC) #16
csmartdalton
On 2016/09/29 20:01:33, reed1 wrote: > is this a replacement for SkTSwap? Can it be? ...
4 years, 2 months ago (2016-09-29 20:09:23 UTC) #17
commit-bot: I haz the power
Committed patchset #4 (id:60001) as https://skia.googlesource.com/skia/+/eb0d91cfa278bceba3ec9a3fdcbc7c47a2ed3a3f
4 years, 2 months ago (2016-09-29 20:11:27 UTC) #19
csmartdalton
4 years, 2 months ago (2016-09-29 20:17:24 UTC) #20
Message was sent while issue was closed.
On 2016/09/29 20:09:23, csmartdalton wrote:
> On 2016/09/29 20:01:33, reed1 wrote:
> > is this a replacement for SkTSwap? Can it be?
> 
> std::exchange isn't quite the same as std::swap.
> 
> Its function is to set a variable and return its old value.
> 
> Using it to "swap" would look like this:
> 
> b = skstd::exchange(a, b);

We could replace SkTSwap with std::swap. SkString is the only class I see that
specializes it, and there we could specialize sts::swap instead.

Powered by Google App Engine
This is Rietveld 408576698