Boostを語れゴラァ part5
■ このスレッドは過去ログ倉庫に格納されています
0261デフォルトの名無しさん
2007/12/28(金) 22:24:08記念に糞patch晒し。
phoenixでstd::mapにoperator[]が使えなくて、渋々phoenix::binary_operatorを特殊化したら
boost::graph内(boost/graph/detail/read_graphviz_spirit.hpp)でも同じことやってるの見つけて
ブチ切れ気味にspecializations for stl iterators and containersとやらを修正してみた。
$ diff -u special_ops.hpp.orig special_ops.hpp
--- special_ops.hpp.orig 2007-12-25 10:49:20.000000000 +0900
+++ special_ops.hpp 2007-12-25 22:08:29.671875000 +0900
@@ -21,6 +21,8 @@
///////////////////////////////////////////////////////////////////////////////
#include <boost/spirit/phoenix/operators.hpp>
#include <iosfwd>
+#include <boost/typeof/typeof.hpp>
+#include <boost/utility/result_of.hpp>
///////////////////////////////////////////////////////////////////////////////
#if defined(_STLPORT_VERSION) && defined(__STL_USE_OWN_NAMESPACE)
@@ -320,7 +322,8 @@
template <typename T0, typename T1>
struct binary_operator<index_op, T0, T1>
{
- typedef typename T0::reference result_type;
+ typedef BOOST_TYPEOF_TPL(&T0::operator[]) index_op_t;
+ typedef typename boost::result_of<index_op_t(T1)>::type result_type;
static result_type eval(T0& container, T1 const& index)
{ return container[index]; }
};
■ このスレッドは過去ログ倉庫に格納されています