正在加载图片...
Throwing an exception(cont Our previous throw example throws an anonymous object of iterator_overflow class and constructor is directly called Also we could clarify the exception object name inline void Fibonacci Iterator: check integrity if(m idx >=Fibonacci m iMaxElems) iterator overflowex(m idx, Fibonacci m iMaxElems) throw ex; i if(m idx > Fibonacci S elems size) Fibonacci gen elems(m idx+ 1)Throwing an exception (cont.) ◼ Our previous throw example throws an anonymous object of iterator_overflow class, and constructor is directly called ◼ Also we could clarify the exception object name inline void Fibonacci_Iterator::check_integrity() { if (m_iIdx >= Fibonacci::m_iMaxElems) { iterator_overflow ex(m_iIdx, Fibonacci::m_iMaxElems); throw ex; } if (m_iIdx >= Fibonacci::s_elems.size()) Fibonacci::gen_elems(m_iIdx + 1); }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有