Arduino equivalent to VB WITH
Arduino equivalent to VB WITH
是否有一个Arduino等同于Visual BASIC"with"概念?
如果我有和 Arduino 结构如下:
typedef struct {
int present = 0; // position now
int demand = 0; // required position
} superStruct;
superStruct super;
我可以说
if (super.present > super.demand) { super.present-=1; }
有没有办法我可以将其缩短为
with super {
if (.present > .demand) { .present-=1; }
}
谢谢!
只是为了补充John Bode的答案:请注意,结构体¹可以访问不带前缀的成员:
struct superStruct {
int present = 0; // position now
int demand = 0; // required position
void update_position() {
if (present > demand) { present-=1; }
}
};
superStruct super;
super.update_position();
¹默认情况下,C++ 中的结构只是一个所有成员都公开的类。
C++中没有等效的语法;必须指定struct
实例以及成员。
相关文章:
- Problems with std::cin.fail()
- 应用程序崩溃并显示"symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5 with link time reference"
- 如何在 64 位 vb.net Windows 应用程序中引用 32 位 dll
- 这对"With a stackless coroutine, only the top-level routine may be suspended."意味着什么
- Boost.TEST with CLion: "Test framework quit unexpectedly"
- 避免碎片化的ClientHellos with OpenSSL (DTLS)
- Issues with Win32 ReadProcessMemory API
- Qt with WinAPI MouseProc
- [[maybe_unused]] with structured_binding?
- Issue with WriteProcessMemory
- OpenCV RTP-Stream with FFMPEG
- "Unable to start debugging. No process is associated with this object." - 在Visual Studio Code中使用GDB
- std::adjacent_difference with std::chrono time_point
- DLL Made with CMake 使程序崩溃
- QtCreator with C 库中的链接器问题
- SHBrowseForFolder with BIF_BROWSEFORCOMPUTER and SHGetPathFr
- specialized std::default_delete with QQmlComponent
- VS2019 - Sudo Remote Debugging on Linux with Cmake project
- Inference pytorch C++ with alexnet and cv::imread image
- Arduino equivalent to VB WITH