#include "spdlog/spdlog.h" #include "SPAServer.h" #include "LHLogInit.h" #include "LHQLogAPI.h" #include "ThreadPool/ThreadPool.h" #include // #include "RingQueue.hpp" void test1(); int main(int argc, char* argv[]) { QCoreApplication app(argc, argv); /* 初始化日志库 */ initLog("SecurePlayAuxServer", g_apiLhQLog); auto logger = spdlog::get("main"); if(logger == nullptr) { SPDLOG_ERROR("main logger is nullptr"); return -1; } SPDLOG_LOGGER_INFO(logger, "★ ★ ★ ★ ★ ★ ☆ ☆ SecurePlayAuxServer ☆ ☆ ★ ★ ★ ★ ★ ★"); /* 设置线程池最大线程个数 */ CPPTP.setThreadMaxNum(256); SPAServer server; // server.startServer(); // return app.exec(); // test1(); } struct Test { Test() { SPDLOG_INFO("构造函数, t:{}", t); } Test(const Test& o) { t = o.t; SPDLOG_INFO("拷贝构造函数, t:{}", t); } Test& operator=(const Test& o) { t = o.t; SPDLOG_INFO("赋值构造函数, t:{}", t); return *this; } ~Test() { SPDLOG_INFO("析构函数"); } int t = 0; }; Test& test2(); Test test3(); std::list listTest; void test1() { Test t; listTest.push_back(t); SPDLOG_INFO("--------------------------"); SPDLOG_INFO("t:{}", t.t); auto it = listTest.front(); it.t = 1; auto it1 = listTest.front(); SPDLOG_INFO("it:{}", it1.t); SPDLOG_INFO("--------------------------"); auto& it2 = listTest.front(); it2.t = 2; SPDLOG_INFO("it2:{}", listTest.front().t); SPDLOG_INFO("--------------------------"); auto& it3 = test2(); SPDLOG_INFO("it3:{}", it3.t); SPDLOG_INFO("--------------------------"); auto it4 = test3(); SPDLOG_INFO("it4:{}", it4.t); } Test& test2() { Test t; t.t = 10; listTest.push_front(t); return listTest.front(); } Test test3() { Test t; t.t = 10; listTest.push_front(t); return listTest.front(); }