尝试抛出异常时c ++模板化函数错误

vim*_*loc 2 c++ templates exception

我有一些代码,我试图在模板化方法中抛出自定义异常.当我尝试编译它时,我收到以下警告:

there are no arguments to ‘Invalid_State_Exception’ that depend on a 
template parameter, so a  declaration of ‘Invalid_State_Exception’ must
be available 
note: (if you use ‘-fpermissive’, G++ will accept your code, but
allowing the use of an undeclared name is deprecated)
Run Code Online (Sandbox Code Playgroud)

到目前为止,我还没有找到解决方法.任何建议都会很棒.这是一些示例代码,解释了我的内容(Foo.h):

 template <class T> class Foo
 {
     public:
         void do_stuff(T t)
         {
             if(bar == true)
             {
                 throw Invalid_State_Exception("FooBar error occurred");
             }
         }

      ....
};

class Invalid_State_Exception : public std::runtime_error
{
    public:
        Invalid_State_Exception(const std::string& msg) :
            std::runtime_error(msg) { }
};
Run Code Online (Sandbox Code Playgroud)

Dan*_*her 6

移动Invalid_State_Exception上面的声明Foo.