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

Side by Side Diff: Source/wtf/text/WTFString.h

Issue 354023003: Add move constructor and assignment operator to RefPtr class (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 String(const char* characters, unsigned length); 116 String(const char* characters, unsigned length);
117 117
118 // Construct a string with latin1 data, from a null-terminated source. 118 // Construct a string with latin1 data, from a null-terminated source.
119 String(const LChar* characters); 119 String(const LChar* characters);
120 String(const char* characters); 120 String(const char* characters);
121 121
122 // Construct a string referencing an existing StringImpl. 122 // Construct a string referencing an existing StringImpl.
123 String(StringImpl* impl) : m_impl(impl) { } 123 String(StringImpl* impl) : m_impl(impl) { }
124 String(PassRefPtr<StringImpl> impl) : m_impl(impl) { } 124 String(PassRefPtr<StringImpl> impl) : m_impl(impl) { }
125 125
126 #if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) 126 #if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) && COMPILER_SUPPORTS(CXX_DEFAULTED_ FUNCTIONS)
127 // We have to declare the copy constructor and copy assignment operator as w ell, otherwise 127 // We have to explicitly declare the move constructor and move copy assignme nt operator. The compiler does
128 // they'll be implicitly deleted by adding the move constructor and move ass ignment operator. 128 // not generate them because the class has an explicitly defined destructor.
129 String(const String& other) : m_impl(other.m_impl) { } 129 String(const String&) = default;
130 String(String&& other) : m_impl(other.m_impl.release()) { } 130 String(String&&) = default;
131 String& operator=(const String& other) { m_impl = other.m_impl; return *this ; } 131 String& operator=(const String&) = default;
132 String& operator=(String&& other) { m_impl = other.m_impl.release(); return *this; } 132 String& operator=(String&&) = default;
133 #endif 133 #endif
134 134
135 // Inline the destructor. 135 // Inline the destructor.
136 ALWAYS_INLINE ~String() { } 136 ALWAYS_INLINE ~String() { }
137 137
138 void swap(String& o) { m_impl.swap(o.m_impl); } 138 void swap(String& o) { m_impl.swap(o.m_impl); }
139 139
140 template<typename CharType> 140 template<typename CharType>
141 static String adopt(StringBuffer<CharType>& buffer) 141 static String adopt(StringBuffer<CharType>& buffer)
142 { 142 {
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 using WTF::charactersToFloat; 701 using WTF::charactersToFloat;
702 using WTF::equal; 702 using WTF::equal;
703 using WTF::equalIgnoringCase; 703 using WTF::equalIgnoringCase;
704 using WTF::find; 704 using WTF::find;
705 using WTF::isAllSpecialCharacters; 705 using WTF::isAllSpecialCharacters;
706 using WTF::isSpaceOrNewline; 706 using WTF::isSpaceOrNewline;
707 using WTF::reverseFind; 707 using WTF::reverseFind;
708 708
709 #include "wtf/text/AtomicString.h" 709 #include "wtf/text/AtomicString.h"
710 #endif // WTFString_h 710 #endif // WTFString_h
OLDNEW
« Source/wtf/text/AtomicString.h ('K') | « Source/wtf/text/AtomicString.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698