如何以非内联方式为专用模板提供额外的成员函数?即
template<typename T>
class sets
{
void insert(const int& key, const T& val);
};
template<>
class sets<bool>
{
void insert(const int& key, const bool& val);
void insert(const int& key){ insert(key, true); };
};
Run Code Online (Sandbox Code Playgroud)
但是,当我写sets<bool>::insert(const int& key)的
template<>
class sets<bool>
{
void insert(const int& key, const bool& val);
void insert(const int& key);
};
template<>
void sets<bool>::insert(const int& key)
{
insert(key, true);
}
Run Code Online (Sandbox Code Playgroud)
海湾合作委员会抱怨:
'void ip_set :: insert(const int&)'的template-id'insert <>'与任何模板声明都不匹配
我有两个独立的git repos,一个包含一个用sbt构建的scala服务器,另一个包含一个用npm/bower/gulp构建的webapp前端.
在服务器repo中,我已经有了构建独立jar的任务(不是标准的包任务); 在frontend repo中,我可以构建npm install && npm run build一个独立的目录_public.
现在我想_public在sbt构建jar任务期间包含UI目录,我想知道除了在sbt中手动生成外部进程以调用npm之外还有更好的方法吗?
我有一个多项目包含一个私有宏子项目,其用途仅限于实现其他子项目的方法体.也不应该在其他子项目的运行时类路径上,也不应该在其他子项目的已发布POM中以任何形式显示.因此,其他sbt项目可以在不知道宏子项目的情况下使用此项目中的库.
对于外部依赖,我发现这个SO Q&A工作得很好,但对于子项目,当我尝试做类似的事情时dependsOn,sbt抱怨配置"compileonly"找不到.
ivyConfigurations += config("compileonly").hide
val macro = Project("macro", file("macro"))
val lib = Project("lib", file("lib")).dependsOn(macro % "compile->compileonly")
Run Code Online (Sandbox Code Playgroud)