Regex refactoring
Tim Shen
timshen91@gmail.com
Thu Nov 7 18:16:00 GMT 2013
On Thu, Nov 7, 2013 at 11:49 AM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> The most common instantiations of _Compiler will probably use const
> char*, std::string::iterator and std::string::const_iterator. It would
> be good if they could all share code, since they all operate on the
> same underlying character type, but I don't know if that's possible.
We may read whole input characters into a basic_string<_CharT> then
use it to initialize _Compiler. Now it can be simplified to:
template<typename _TraitsT>
class _Compiler
{
typedef typename _TraitsT::char_type _CharT;
...
_Compiler(basic_string<_CharT>&& __input_string);
};
It requires more memory, but I don't think storing a string which
describing a regex is unacceptable.
Does this make sense?
Thank you!
--
Regards,
Tim Shen
More information about the Libstdc++
mailing list