summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-05-25 21:46:07 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-05-25 21:46:07 +0000
commitcd9bc5fa836fdf196dc65f7f75631f80849eed1e (patch)
treec9c055cd9da166c04d6113439e83f9966fe2b696
parent1a1cc6f7f4f1591f87be3bab4cb8886e145dd333 (diff)
Added support for Sun C++ compiler
git-svn-id: http://pugixml.googlecode.com/svn/trunk@452 99668b35-9821-0410-8761-19e4c4f06640
-rw-r--r--src/pugixml.cpp16
-rw-r--r--src/pugixml.hpp18
-rw-r--r--src/pugixpath.cpp2
3 files changed, 35 insertions, 1 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index feece49..0706ef4 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -4516,6 +4516,22 @@ namespace std
}
#endif
+#if !defined(PUGIXML_NO_STL) && defined(__SUNPRO_CC)
+namespace std
+{
+ // Workarounds for (non-standard) iterator category detection
+ std::bidirectional_iterator_tag __iterator_category(const pugi::xml_node_iterator&)
+ {
+ return std::bidirectional_iterator_tag();
+ }
+
+ std::bidirectional_iterator_tag __iterator_category(const pugi::xml_attribute_iterator&)
+ {
+ return std::bidirectional_iterator_tag();
+ }
+}
+#endif
+
/**
* Copyright (c) 2006-2010 Arseny Kapoulkine
*
diff --git a/src/pugixml.hpp b/src/pugixml.hpp
index 9b0eddd..f57dba2 100644
--- a/src/pugixml.hpp
+++ b/src/pugixml.hpp
@@ -21,12 +21,21 @@ namespace std
{
struct bidirectional_iterator_tag;
+#ifdef __SUNPRO_CC
+ // Sun C++ compiler has a bug which forces template argument names in forward declarations to be the same as in actual definitions
+ template <class _T> class allocator;
+ template <class _charT> struct char_traits;
+ template <class _charT, class _Traits> class basic_istream;
+ template <class _charT, class _Traits> class basic_ostream;
+ template <class _charT, class _Traits, class _Allocator> class basic_string;
+#else
// Borland C++ compiler has a bug which forces template argument names in forward declarations to be the same as in actual definitions
template <class _Ty> class allocator;
template <class _Ty> struct char_traits;
template <class _Elem, class _Traits> class basic_istream;
template <class _Elem, class _Traits> class basic_ostream;
template <class _Elem, class _Traits, class _Ax> class basic_string;
+#endif
// Digital Mars compiler has a bug which requires a forward declaration for explicit instantiation (otherwise type selection is messed up later, producing link errors)
// Also note that we have to declare char_traits as a class here, since it's defined that way
@@ -2330,6 +2339,15 @@ namespace std
}
#endif
+#if !defined(PUGIXML_NO_STL) && defined(__SUNPRO_CC)
+namespace std
+{
+ // Workarounds for (non-standard) iterator category detection
+ std::bidirectional_iterator_tag __iterator_category(const pugi::xml_node_iterator&);
+ std::bidirectional_iterator_tag __iterator_category(const pugi::xml_attribute_iterator&);
+}
+#endif
+
#endif
/**
diff --git a/src/pugixpath.cpp b/src/pugixpath.cpp
index d11a7ca..d409655 100644
--- a/src/pugixpath.cpp
+++ b/src/pugixpath.cpp
@@ -768,7 +768,7 @@ namespace pugi
{
if (begin == end) return;
- size_t count = std::distance(begin, end);
+ size_t count = end - begin;
size_t size = m_end - m_begin;
size_t capacity = m_eos - m_begin;