尝试找出[[maybe_unused]]
属性的正确语法导致following code:
int main()
{
typedef int X; // warning
[[maybe_unused]] typedef int Y; // Ok
using Z = int; // warning
//[[maybe_unused]] using W1 = int; // error: expected ';' before 'using'
//using [[maybe_unused]] W2 = int; // error: expected nested-name-specifier before '[' token
using W3 [[maybe_unused]] = int; // Ok
//using W4 = [[maybe_unused]] int; // error: an attribute list cannot appear here
}
所有突然之间只有在目标类型名称之后写入才有效。这看起来很奇怪,因为它通常放在前面。这真的是一个正确的语法还是仅仅是编译器故障?
答案 0 :(得分:4)
=
可选的 attribute-specifier-seq 位于标识符之后和ArrayList<String> visitedLinks = new ArrayList<String>();
List<WebElement> elements = driver.findElements(By.tagName("a"));
for(WebElement element : elements) {
if(visitedLinks.contains(element.getAttribute("href"))) {
System.out.println("Link already checked. Not checking.");
} else {
visitedLinks.add(element.getAttribute("href"));
// Your link checking code
}
}
之前。