Update of /cvsroot/boost/boost/boost/xpressive/proto
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14502/proto
Modified Files:
debug.hpp proto_fwd.hpp
Log Message:
when pretty-printing expressions, check for ostream inserters for tag types
Index: debug.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/debug.hpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- debug.hpp 23 Jun 2007 21:22:30 -0000 1.11
+++ debug.hpp 26 Jun 2007 00:16:04 -0000 1.12
@@ -28,10 +28,35 @@
{
namespace tag
{
+ namespace hidden_detail_
+ {
+ typedef char (¬_ostream)[sizeof(std::ostream)+1];
+ not_ostream operator<<(std::ostream &, detail::dont_care);
+
+ template<typename Tag, std::size_t S>
+ struct printable_tag_
+ {
+ typedef char const *type;
+ static type call() { return typeid(Tag).name(); }
+ };
+
+ template<typename Tag>
+ struct printable_tag_<Tag, sizeof(std::ostream)>
+ {
+ typedef Tag type;
+ static type call() { return Tag(); }
+ };
+
+ template<typename Tag>
+ struct printable_tag
+ : printable_tag_<Tag, sizeof(std::cout << Tag())>
+ {};
+ }
+
template<typename Tag>
- inline char const *proto_tag_name(Tag)
+ inline typename hidden_detail_::printable_tag<Tag>::type
proto_tag_name(Tag)
{
- return typeid(Tag).name();
+ return hidden_detail_::printable_tag<Tag>::call();
}
#define BOOST_PROTO_DEFINE_TAG_NAME(Tag)\
@@ -108,21 +133,22 @@
this->first_ = false;
}
- #define BOOST_PROTO_ARG(z, n, data)\
- display(proto::arg_c<n>(expr));\
+ #define BOOST_PROTO_ARG(z, n, data)
\
+ display(proto::arg_c<n>(expr));
\
/**/
- #define BOOST_PP_LOCAL_MACRO(N)\
- template<typename Tag, typename Args>\
- void operator()(expr<Tag, Args, N> const &expr) const\
- {\
- this->sout_ << std::setw(this->depth_) << (this->first_? "" :
", ")\
- << proto_tag_name(Tag()) << "(\n";\
- display_expr display(this->depth_ + 4, this->sout_);\
- BOOST_PP_REPEAT(N, BOOST_PROTO_ARG, _)\
- this->sout_ << std::setw(this->depth_) << "" << ")\n";\
- this->first_ = false;\
- }\
+ #define BOOST_PP_LOCAL_MACRO(N)
\
+ template<typename Tag, typename Args>
\
+ void operator()(expr<Tag, Args, N> const &expr) const
\
+ {
\
+ using namespace tag;
\
+ this->sout_ << std::setw(this->depth_) << (this->first_? "" :
", ") \
+ << proto_tag_name(Tag()) << "(\n";
\
+ display_expr display(this->depth_ + 4, this->sout_);
\
+ BOOST_PP_REPEAT(N, BOOST_PROTO_ARG, _)
\
+ this->sout_ << std::setw(this->depth_) << "" << ")\n";
\
+ this->first_ = false;
\
+ }
\
/**/
#define BOOST_PP_LOCAL_LIMITS (1, BOOST_PROTO_MAX_ARITY)
Index: proto_fwd.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/proto_fwd.hpp,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- proto_fwd.hpp 25 Jun 2007 05:39:40 -0000 1.79
+++ proto_fwd.hpp 26 Jun 2007 00:16:04 -0000 1.80
@@ -47,6 +47,14 @@
namespace boost { namespace proto
{
+ namespace detail
+ {
+ struct dont_care
+ {
+ dont_care(...);
+ };
+ }
+
///////////////////////////////////////////////////////////////////////////////
// Operator tags
namespace tag
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs