问题描述
此站点有50多个关于该主题的帖子,几种“检测模式”在各个时期都取得了成功。使用C ++ 20,我们应该在这里看到很多简化。
那么,目前的最佳检测方法是什么
- A。全局功能
- B。成员功能
- 确切的签名。例如。检测到
F( int )
已定义,而不是通过(隐式)转换获取int的任何F
。 - 可调用给定类型(在隐式转换的常规规则下)
解决方法
基本上需要表达式:
Sig
using Sig = RV (*) (Args); // A
using Sig = RV (Class::*) (Args); // B
应该是:
init() {
do {
// Get database path
if let path = NSSearchPathForDirectoriesInDomains(.documentDirectory,.userDomainMask,true).first {
// Connect to database
db = try Connection("\(path)/db.sqlite3")
// Initialize tables
try db?.run(rssNewspaper.create(ifNotExists: true) { table in
table.column(rssNewspaperId,primaryKey: .autoincrement)
table.column(rssNewspaperName)
table.column(rssIsActive)
})
}
} catch {
print(error.localizedDescription)
}
}