FTXUI 7.0.3
C++ functional terminal UI.
Loading...
Searching...
No Matches
ref.cpp
Go to the documentation of this file.
1// Copyright 2026 Arthur Sonzogni. All rights reserved.
2// Use of this source code is governed by the MIT license that can be found in
3// the LICENSE file.
4#include "ftxui/util/ref.hpp"
5
6#include <utility>
7
8namespace ftxui {
9
10namespace {
11
12// StringRef、ConstStringRef 及 ConstStringListRef 都有匯出
13// (FTXUI_EXPORT(SCREEN)),但它們所有的成員函式──包括
14// 從 Ref<string>/ConstRef<string> 繼承而來的函式──都是內聯定義在
15// 標頭檔中,且從未在 libftxui-screen 內部被 odr-use。在
16// Windows 上,MSVC 只會將第一次被 odr-use 的內聯成員
17// 函式發出(因此匯出)到 DLL 中;否則針對 dllimport 宣告連結的
18// 使用者會遇到未解析的外部符號。此
19// 函式的存在純粹是為了強制進行該實例化。
20[[maybe_unused]] void ForceSymbolInstantiation() {
21 StringRef s = "a";
22 StringRef s2(s);
23 StringRef s3(std::move(s2));
24 s = s3;
25 s = std::move(s3);
26 (void)s();
27 (void)*s;
28 (void)s.operator->();
29
30 ConstStringRef c = "a";
31 ConstStringRef c2(c);
32 ConstStringRef c3(std::move(c2));
33 c = c3;
34 c = std::move(c3);
35 (void)c();
36 (void)*c;
37
38 ConstStringListRef l;
39 ConstStringListRef l2(l);
40 ConstStringListRef l3(std::move(l2));
41 l = l3;
42 l = std::move(l3);
43 (void)l.size();
44 (void)l[0];
45}
46
47} // namespace
48
49} // namespace ftxui
FTXUI ftxui:: 命名空間
Definition animation.hpp:11