|
Boost Users : |
From: Bill Buklis (boostuser_at_[hidden])
Date: 2007-08-10 13:27:56
>
> Maybe I still don't understand, but I wanted to point out that a pattern
> with "<*,*>" still matches a three-argument template, because the
> pattern matching is text-based (as I mention in the wiki guide).
>
> Most of the std:: visualizers don't actually use the template argument,
> so they're fine with a single * (it suffices that the pattern matches),
> and those that do use the asterisks correctly (auto_ptr<*>, deque<*,*>).
> > As an aside, I've discovered that the $T1,$T2, etc. seem to go by the
> > "asterisks" and not by the template arguments. Given
> class_name<void**,*>
> > for example $T3 represents the second template argument. Go figure. At
> least
> > that was the case when I did the visualizer for
> > boost::void_ptr_iterator<void**,*> (used by ptr_array).
> >
> >
> Again, due to the textual processing of the typenames. In the case of
> class_name<void**,*> (a pattern, right?), $T1 and $T2 simply match the
> empty string ($T1 maybe some pointer "*"s or "const *", depending what
> class is being matched against), and $T3 is indeed the second template
> parameter. That's what I think is the way it works - no way of telling
> that a "*" in a pattern is not a wildcard.
That sounds right. It does seem clearly text based processing. I guess I was
expecting more sophisticated C++ matching. But, that's probably not needed
here and might be too slow anyway.
Here's one more tidbit you may wish to consider for the wiki guide. While
doing a visualizer for a specialized date/time class we have, I discovered a
bug in the visualizer handling. Colons cannot be used in literal text
strings. See the example below. I don't know if there are any other invalid
characters. I did not do an exhaustive test.
I reported it to Microsoft and they acknowledged the problem. In there
infinite wisdom, they decided it wasn't worth fixing (see
http://tinyurl.com/2lcqzn for the bug report).
Example:
class test
{
public:
int hour;
int minute;
int second;
};
autoexp.dat entry:
test{
preview
(
#( $c.hour, ":", $c.minute, ":", $c.second )
)
}
The quoted colon causes an error in the visualizer parsing. Changing to
another character will succeed.
-- Bill --
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net