mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-24 22:02:44 -06:00
Core: Vector::operator<<(T&&) (thanks Novo)
git-svn-id: svn://ultimatepp.org/upp/trunk@14034 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
e98b8bca4d
commit
dae9d4bf88
5 changed files with 25 additions and 8 deletions
|
|
@ -195,6 +195,7 @@ public:
|
|||
operator const T*() const { return (T*)vector; }
|
||||
|
||||
Vector& operator<<(const T& x) { Add(x); return *this; }
|
||||
Vector& operator<<(T&& x) { Add(pick(x)); return *this; }
|
||||
|
||||
#ifdef UPP
|
||||
void Serialize(Stream& s) { StreamContainer(s, *this); }
|
||||
|
|
|
|||
|
|
@ -463,16 +463,24 @@ onst]&]
|
|||
[s4;%- &]
|
||||
[s5;:Vector`:`:operator`<`<`(const T`&`):%- [_^Vector^ Vector][@(0.0.255) `&]_[* operator<<
|
||||
]([@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[*@3 x])&]
|
||||
[s2; Operator replacement of [* void Add(const T`&x)]. By returning
|
||||
[s2; Operator equivalent of [* void Add(const T`&x)]. By returning
|
||||
reference to to Vector allows adding more elements in single
|
||||
expression, thus e.g. allowing to construct temporary Vector
|
||||
as part of expression like Foo((Vector<int>() << 1 << 2 << 4)).&]
|
||||
[s6; Requires T to have deep copy constructor.&]
|
||||
[s6; Invalidates iterators and references to Vector.&]
|
||||
[s7; [*C@3 x]-|The value that is copied to newly created element.&]
|
||||
[s7; [*/ Return value]-|Reference to Vector (`*this).&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:Upp`:`:Vector`:`:operator`<`<`(T`&`&`):%- [_^Upp`:`:Vector^ Vector][@(0.0.255) `&]_[* o
|
||||
perator<<]([*@4 T][@(0.0.255) `&`&]_[*@3 x])&]
|
||||
[s2; Operator equivalent of [* void Add(TT`&x)]. By returning reference
|
||||
to to Vector allows adding more elements in single expression,
|
||||
thus e.g. allowing to construct temporary Vector as part of expression
|
||||
like.&]
|
||||
[s6; Requires T to have deep copy constructor.&]
|
||||
[s6; Invalidates iterators and references to Vector.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:Vector`:`:ToString`(`)const:%- [_^String^ String]_[* ToString]()_[@(0.0.255) const]&]
|
||||
[s2; Converts container into String, mostly for debugging purposes.&]
|
||||
[s3;%- &]
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
- Inactive doc icon is not updated - [B] does not blink anymore
|
||||
- Make allocator work
|
||||
- MacOS crash when adding Label to TestChStyles
|
||||
- Unknown layout type should have better visual
|
||||
|
||||
NTH:
|
||||
|
||||
|
|
@ -19,6 +18,7 @@ DONE:
|
|||
- Classic is broken
|
||||
- ClassicCtrlsImg
|
||||
- Ide: When dark editor in light theme, svn history is invisible (as text is white)
|
||||
- Unknown layout type should have better visual
|
||||
|
||||
macos done:
|
||||
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ public:
|
|||
FileSelNative();
|
||||
};
|
||||
|
||||
typedef FileSelector FileSelNative;
|
||||
typedef FileSelNative FileSelector;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -394,7 +394,7 @@ public:
|
|||
FileSelNative();
|
||||
};
|
||||
|
||||
typedef FileSelector FileSelNative;
|
||||
typedef FileSelNative FileSelector;
|
||||
#endif
|
||||
|
||||
class CtrlMapper {
|
||||
|
|
|
|||
|
|
@ -222,9 +222,17 @@ void LayoutItem::UnknownPaint(Draw& w)
|
|||
int q = FindProperty("SetLabel");
|
||||
if(q >= 0 && IsString(~property[q]))
|
||||
DrawSmartText(w, 0, 0, csize.cx, ToUtf8((WString)~property[q]));
|
||||
Size tsz = GetTextSize(type, LayFont());
|
||||
Font fnt = LayFont();
|
||||
String s = type;
|
||||
Color ink = White();
|
||||
if(IsNull(s)) {
|
||||
s = "Untyped";
|
||||
fnt.Italic();
|
||||
ink = LtCyan();
|
||||
}
|
||||
Size tsz = GetTextSize(s, fnt);
|
||||
w.DrawRect(csize.cx - tsz.cx - tsz.cy, csize.cy - tsz.cy, tsz.cx + tsz.cy, tsz.cy, SGray());
|
||||
w.DrawText(csize.cx - tsz.cx - tsz.cy / 2, csize.cy - tsz.cy, type, LayFont(), White());
|
||||
w.DrawText(csize.cx - tsz.cx - tsz.cy / 2, csize.cy - tsz.cy, s, fnt, ink);
|
||||
}
|
||||
|
||||
void LayoutItem::CreateMethods(EscValue& ctrl, const String& type, bool copy) const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue