0
我使用JsonCPP 0.6.0,它不支持BOOST_FOREACH
。罗伯特答已使patch使用BOOST_FOREACH
。这里是差异。我可以在Class之外typedef吗?
Index: value.h
===================================================================
--- value.h (revision 54283)
+++ value.h (working copy)
@@ -919,6 +919,7 @@
class ValueIteratorBase
{
public:
+ typedef std::bidirectional_iterator_tag iterator_category;
typedef unsigned int size_t;
typedef int difference_type;
typedef ValueIteratorBase SelfType;
@@ -990,6 +991,7 @@
{
friend class Value;
public:
+ typedef const Value value_type;
typedef unsigned int size_t;
typedef int difference_type;
typedef const Value &reference;
@@ -1048,6 +1050,7 @@
{
friend class Value;
public:
+ typedef Value value_type;
typedef unsigned int size_t;
typedef int difference_type;
typedef Value &reference;
所以我需要在json/include/value.h
加3线,但我不希望编辑原始标题的文件,但想在我自己的源代码添加3行。像这样:
typedef std::bidirectional_iterator_tag Json::ValueIteratorBase::iterator_category;
当然,我得到了一个错误error: typedef name may not be a nested-name-specifier
。 我可以这样做吗?
PS。 JsonCPP 0.7.0支持BOOST_FOREACH
。但在我的情况下,我现在无法升级JsonCPP。