我正在尝试做类似以下的事情:
template <typename T>
struct A
{
template <typename U>
struct AA
{
};
};
template <typename V, template <typename> class W = A<V>::AA> // Causes C3202
struct B
{
};
Run Code Online (Sandbox Code Playgroud)
但Visual Studio 2010编译器吐出:
错误C3202:'AA':模板参数''的默认参数无效,需要一个类模板
如果我用以下模板替换B:
// Replace "T" with "int"
template <typename V, template <typename> class W = A<int>::AA>
struct B
{
};
Run Code Online (Sandbox Code Playgroud)
代码编译得很好,但不是我想要的.如果原始文件不是合法的C++,是否有替代方案为"B"模板的用户提供类似的界面?
这是一个说明我问题的最小例子:
:: test.bat
@echo off
call test2.bat 2>&1 | findstr foo
echo done calling test2
:: test2.bat
@echo off
start /B notepad >NUL
echo done starting child process
Run Code Online (Sandbox Code Playgroud)
在此示例中,在记事本关闭之前,findstr将无法完成,可能是因为记事本已从父cmd进程继承了stdout.如何修改test2.bat以便test.bat不挂起?