小编Has*_*eed的帖子

将进攻性句子列入黑名单

我创造了一款面向年轻观众的游戏,并试图过滤掉亵渎和冒犯的名字

#include <iostream>
#include <vector>

bool isBanned( std::string text ) {
    std::vector bannedSent = {
        "Profanity1",
        "Profanity2",
        "Profanity3",
        "Profanity4"
    };
    for(auto &i : bannedSent) {
        if(text == i) { return true; }
    }
    return false;
}
Run Code Online (Sandbox Code Playgroud)

我在编写错误时谈到"模板参数",就行了std::vector,这是什么意思?

c++ templates vector

1
推荐指数
1
解决办法
75
查看次数

标签 统计

c++ ×1

templates ×1

vector ×1