From: Luke Stebbing (ls_at_[hidden])
Date: 2004-01-14 18:31:11
> > Why is regex's constructor explicit? Certainly for something like
> > you don't want the size constructor to turn into a conversion from int.
> 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.
Unlike the fundamental and standard types, regex doesn't appear in standard
functions, and only has a few operator overloads. In fact, string's
overloads form a proper superset. The only functions where the regex type
appears are the regex utility functions themselves, and it seems unlikely
that a user would accidentally construct a regex with them.
Are there any examples where a user might inadvertantly construct a regex
from a string, were the constructor implicit?
- Luke Stebbing
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk