// use typeid() comparison, e.g., when our types may travel across
// different shared libraries.
template<typename ValueType>
- ValueType * unsafe_any_cast(any * operand)
+ inline ValueType * unsafe_any_cast(any * operand)
{
return &static_cast<any::holder<ValueType> *>(operand->content)->held;
}
template<typename ValueType>
- const ValueType * unsafe_any_cast(const any * operand)
+ inline const ValueType * unsafe_any_cast(const any * operand)
{
- return any_cast<ValueType>(const_cast<any *>(operand));
+ return unsafe_any_cast<ValueType>(const_cast<any *>(operand));
}
}
// visit_each, ADL
-#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ )
+#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ ) \
+ && !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
template<class V, class T> void visit_each( V & v, value<T> const & t, int )
{
// visit_each, no ADL
-#if defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) || defined( __BORLANDC__ )
+#if defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) || defined( __BORLANDC__ ) \
+ || (defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
template<class V, class T> void visit_each( V & v, _bi::value<T> const & t, int )
{
# define BOOST_HAS_THREADS
# define BOOST_HAS_PTHREADS
# endif
+#elif defined(__HP_aCC) && !defined(BOOST_DISABLE_THREADS)
+# define BOOST_HAS_PTHREADS
#endif
// boilerplate code:
#endif
+
outer_no_type reference_to_pointer_helper(...);
template <class T>
-struct is_reference_to_pointer
+struct reference_to_pointer_impl
{
static T t;
BOOST_STATIC_CONSTANT(
bool, value
- = (is_reference<T>::value
- && sizeof((reference_to_pointer_helper)(t)) == sizeof(inner_yes_type))
+ = (sizeof((reference_to_pointer_helper)(t)) == sizeof(inner_yes_type))
);
typedef mpl::bool_<value> type;
-
+};
+
+template <class T>
+struct is_reference_to_pointer
+ : mpl::eval_if<is_reference<T>, reference_to_pointer_impl<T>, mpl::false_>::type
+{
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_pointer,(T))
};
template <class T>
struct is_reference_to_function_pointer
- : mpl::if_<
- is_reference<T>
- , is_pointer_to_function_aux<T>
- , mpl::bool_<false>
- >::type
+ : mpl::eval_if<is_reference<T>, is_pointer_to_function_aux<T>, mpl::false_>::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_function_pointer,(T))
};
reinterpret_cast<const functor_type*>(&in_buffer.data);
new ((void*)&out_buffer.data) functor_type(*in_functor);
} else if (op == destroy_functor_tag) {
- functor_type* out_functor =
- reinterpret_cast<functor_type*>(&out_buffer.data);
// Some compilers (Borland, vc6, ...) are unhappy with ~functor_type.
- out_functor->~Functor();
+ reinterpret_cast<functor_type*>(&out_buffer.data)->~Functor();
} else /* op == check_functor_type_tag */ {
const std::type_info& check_type =
*static_cast<const std::type_info*>(out_buffer.const_obj_ptr);
# define BOOST_FUNCTION_RETURN(X) X; return BOOST_FUNCTION_VOID_RETURN_TYPE ()
#endif
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable: 4127) // conditional expression is constant.
+#endif
+
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable: 4127) // conditional expression is constant.
+#endif
+
namespace boost {
namespace detail {
namespace function {
}
};
+#ifdef BOOST_MSVC
+# pragma warning(pop)
+#endif
+
#undef BOOST_FUNCTION_PARTIAL_SPEC
#endif // have partial specialization
} // end namespace boost
+#ifdef BOOST_MSVC
+# pragma warning(pop)
+#endif
+
// Cleanup after ourselves...
#undef BOOST_FUNCTION_VTABLE
#undef BOOST_FUNCTION_DEFAULT_ALLOCATOR
{
return ((c >= (1 << CHAR_BIT)) ? true : map[c] & mask);
}
-#if !defined(__HP_aCC)
+#if !defined(__hpux) // can't use WCHAR_MIN in pp-directive
#if defined(WCHAR_MIN) && (WCHAR_MIN == 0) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
inline bool can_start(wchar_t c, const unsigned char* map, unsigned char mask)
{
#pragma warning(disable:4127 4244)
#endif
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
- if(next_count->get_id() != rep->id)
- {
- // we're moving to a different repeat from the last
- // one, so set up a counter object and recurse:
- repeater_count<BidiIterator> r(rep->id, &next_count, position);
- return match_rep();
- }
+ //
+ // Always copy the repeat count, so that the state is restored
+ // when we exit this scope:
+ //
+ repeater_count<BidiIterator> r(rep->id, &next_count, position);
//
// If we've had at least one repeat already, and the last one
// matched the NULL string then set the repeat count to
{
return false;
}
-#ifndef __HP_aCC
+#ifndef __hpux // can't use WCHAR_MIN/MAX in pp-directives.
#ifdef _MSC_VER
template<>
inline bool is_combining<wchar_t>(wchar_t c)
typedef const stored_group& first_argument_type;
typedef const stored_group& second_argument_type;
- group_bridge_compare(const Compare& c) : comp(c) {}
+ group_bridge_compare(const Compare& c) : comp(c)
+ { }
bool operator()(const stored_group& k1, const stored_group& k2) const
{
connection_slot_pair,
forward_traversal_tag> inherited;
public:
- named_slot_map_iterator();
- named_slot_map_iterator(const named_slot_map_iterator&);
- named_slot_map_iterator& operator=(const named_slot_map_iterator&);
-
- connection_slot_pair& dereference() const;
- void increment();
- bool equal(const named_slot_map_iterator& other) const;
+ named_slot_map_iterator() : slot_assigned(false)
+ { }
+ named_slot_map_iterator(const named_slot_map_iterator& other)
+ : group(other.group), last_group(other.last_group),
+ slot_assigned(other.slot_assigned)
+ {
+ if (slot_assigned) slot_ = other.slot_;
+ }
+ named_slot_map_iterator& operator=(const named_slot_map_iterator& other)
+ {
+ slot_assigned = other.slot_assigned;
+ group = other.group;
+ last_group = other.last_group;
+ if (slot_assigned) slot_ = other.slot_;
+ return *this;
+ }
+ connection_slot_pair& dereference() const
+ {
+ return *slot_;
+ }
+ void increment()
+ {
+ ++slot_;
+ if (slot_ == group->second.end()) {
+ ++group;
+ init_next_group();
+ }
+ }
+ bool equal(const named_slot_map_iterator& other) const {
+ return (group == other.group
+ && (group == last_group
+ || slot_ == other.slot_));
+ }
#if BOOST_WORKAROUND(_MSC_VER, <= 1400)
void decrement();
BOOST_SIGNALS_NAMESPACE::connect_position at
= BOOST_SIGNALS_NAMESPACE::at_back);
-#if BOOST_WORKAROUND(BOOST_MSVC, <= 0x1700)
+#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
// MSVC 6.0 and 7.0 don't handle the is_convertible test well
void disconnect(const group_type& group)
{
/*=============================================================================
Copyright (c) 2002 Juan Carlos Arevalo-Baeza
- Copyright (c) 2002-2003 Hartmut Kaiser
+ Copyright (c) 2002-2006 Hartmut Kaiser
Copyright (c) 2003 Giovanni Bajo
http://spirit.sourceforge.net/
// newlines since no column tracking is needed.
//
///////////////////////////////////////////////////////////////////////////////
-template <>
-class position_policy<file_position_without_column> {
+template <typename String>
+class position_policy<file_position_without_column_base<String> > {
public:
- void next_line(file_position_without_column& pos)
+ void next_line(file_position_without_column_base<String>& pos)
{
++pos.line;
}
void set_tab_chars(unsigned int /*chars*/){}
- void next_char(file_position_without_column& /*pos*/) {}
- void tabulation(file_position_without_column& /*pos*/) {}
+ void next_char(file_position_without_column_base<String>& /*pos*/) {}
+ void tabulation(file_position_without_column_base<String>& /*pos*/) {}
};
///////////////////////////////////////////////////////////////////////////////
// of position_iterator.
//
///////////////////////////////////////////////////////////////////////////////
-template <>
-class position_policy<file_position> {
+template <typename String>
+class position_policy<file_position_base<String> > {
public:
position_policy()
: m_CharsPerTab(4)
{}
- void next_line(file_position& pos)
+ void next_line(file_position_base<String>& pos)
{
++pos.line;
pos.column = 1;
m_CharsPerTab = chars;
}
- void next_char(file_position& pos)
+ void next_char(file_position_base<String>& pos)
{
++pos.column;
}
- void tabulation(file_position& pos)
+ void tabulation(file_position_base<String>& pos)
{
pos.column += m_CharsPerTab - (pos.column - 1) % m_CharsPerTab;
}
/*=============================================================================
Copyright (c) 2002 Juan Carlos Arevalo-Baeza
- Copyright (c) 2002-2003 Hartmut Kaiser
+ Copyright (c) 2002-2006 Hartmut Kaiser
Copyright (c) 2003 Giovanni Bajo
http://spirit.sourceforge.net/
// and the line number
//
///////////////////////////////////////////////////////////////////////////////
-struct file_position_without_column {
- std::string file;
+template <typename String>
+struct file_position_without_column_base {
+ String file;
int line;
- file_position_without_column(std::string const& file_ = std::string(),
+ file_position_without_column_base(String const& file_ = String(),
int line_ = 1):
file (file_),
line (line_)
{}
- bool operator==(const file_position_without_column& fp) const
+ bool operator==(const file_position_without_column_base& fp) const
{ return line == fp.line && file == fp.file; }
};
// line and column number
//
///////////////////////////////////////////////////////////////////////////////
-struct file_position : public file_position_without_column {
+template <typename String>
+struct file_position_base : public file_position_without_column_base<String> {
int column;
- file_position(std::string const& file_ = std::string(),
- int line_ = 1, int column_ = 1):
- file_position_without_column (file_, line_),
+ file_position_base(String const& file_ = String(),
+ int line_ = 1, int column_ = 1):
+ file_position_without_column_base<String> (file_, line_),
column (column_)
{}
- bool operator==(const file_position& fp) const
- { return column == fp.column && line == fp.line && file == fp.file; }
+ bool operator==(const file_position_base& fp) const
+ { return column == fp.column && this->line == fp.line && this->file == fp.file; }
};
-
///////////////////////////////////////////////////////////////////////////////
//
// position_policy<>
// This is the version of the current Spirit distribution
//
///////////////////////////////////////////////////////////////////////////////
-#define SPIRIT_VERSION 0x1803
+#define SPIRIT_VERSION 0x1804
#define SPIRIT_PIZZA_VERSION SPIRIT_DOUBLE_CHEESE // :-)
#endif // defined(SPIRIT_VERSION_HPP)
#endif
struct integral_constant : public mpl::integral_c<T, val>
{
- //BOOST_STATIC_CONSTANT(T, value = val);
- //typedef T value_type;
typedef integral_constant<T,val> type;
-
-#if 0
- //
- // everything that follows now, is MPL-compatibility code:
- //
- typedef ::boost::mpl::integral_c_tag tag;
-
- // have to #ifdef here: some compilers don't like the 'val + 1' form (MSVC),
- // while some other don't like 'value + 1' (Borland), and some don't like
- // either
-#if BOOST_WORKAROUND(__EDG_VERSION__, <= 243)
-private:
- BOOST_STATIC_CONSTANT(T, next_value = BOOST_MPL_AUX_STATIC_CAST(T, (val + 1)));
- BOOST_STATIC_CONSTANT(T, prior_value = BOOST_MPL_AUX_STATIC_CAST(T, (val - 1)));
-public:
- typedef integral_constant<T,next_value> next;
- typedef integral_constant<T,prior_value> prior;
-#elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \
- || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502)) \
- || BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(53800))
- typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (val + 1)) )> next;
- typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (val - 1)) )> prior;
-#else
- typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (value + 1)) )> next;
- typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (value - 1)) )> prior;
-#endif
-
- // enables uniform function call syntax for families of overloaded
- // functions that return objects of both arithmetic ('int', 'long',
- // 'double', etc.) and wrapped integral types (for an example, see
- // "mpl/example/power.cpp")
- operator T() const { return static_cast<T>(this->value); }
-#endif
};
template<> struct integral_constant<bool,true> : public mpl::true_
typedef slot_container_type::iterator group_iterator;
typedef slot_container_type::const_iterator const_group_iterator;
-named_slot_map_iterator::named_slot_map_iterator() : slot_assigned(false) {}
-
-named_slot_map_iterator::
-named_slot_map_iterator(const named_slot_map_iterator& other)
- : group(other.group), last_group(other.last_group),
- slot_assigned(other.slot_assigned)
-{
- if (slot_assigned) slot_ = other.slot_;
-}
-
-named_slot_map_iterator&
-named_slot_map_iterator::operator=(const named_slot_map_iterator& other)
-{
- slot_assigned = other.slot_assigned;
- group = other.group;
- last_group = other.last_group;
- if (slot_assigned) slot_ = other.slot_;
- return *this;
-}
-
-
-connection_slot_pair& named_slot_map_iterator::dereference() const
-{ return *slot_; }
-
-void named_slot_map_iterator::increment()
-{
- ++slot_;
- if (slot_ == group->second.end()) {
- ++group;
- init_next_group();
- }
-}
-
-bool
-named_slot_map_iterator::equal(const named_slot_map_iterator& other) const
-{
- return (group == other.group
- && (group == last_group
- || slot_ == other.slot_));
-}
#if BOOST_WORKAROUND(_MSC_VER, <= 1400)
void named_slot_map_iterator::decrement() { assert(false); }