From: John Maddock (john_at_[hidden])
Date: 2004-01-14 07:12:35


> Why is regex's constructor explicit? Certainly for something like vector,
> you don't want the size constructor to turn into a conversion from int.
But
> it seems to me that allowing
>
> regex_merge(" foo ", "\\A\\s*(.*?)\\s*\\z", "$1")
>
> instead of the current
>
> regex_merge(" foo ", regex("\\A\\s*(.*?)\\s*\\z"), "$1")
>
> wouldn't introduce any safety issues. Sure, you could get the order of
the
> arguments wrong, but you can do that anyways when you're using a temporary
> regex.

Constructing a regex is generally an expensive operation, so it's explicit
to ensure that regular expressions are only created when the user really
means it.

John.