ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> cpp-sig
cpp-sig
[C++-sig] Re: Re: Compile failure with object in V2
by Dave Hawkes other posts by this author
Jul 14 2002 3:16PM messages near this date
Re: [C++-sig] Re: Re: Compile failure with object in V2 | Re: [C++-sig] Re: Compile failure with object in V2
"David Abrahams" <david.abrahams@[...].com>  wrote in message
news:1cd801c22b2a$0b843630$6601a8c0@[...]..
>  From: "Dave Hawkes" <daveh@[...].com>
> 
> 
>  >

>  If you want to try something, try doing a search/replace which turns all
>  instances of "c##" in boost/python/detail/returning.hpp into "zyx##".
> 
>  I've seen VC6 get confused about which entities a name should refer to
when
>  there's more than one possibility before.
> 

This made no difference :(

However by testing components of the constructor individually it would
appear that the compiler is objecting to passing the reference "x" to the
object_initializer::get function. This can be worked around by passing a
pointer instead, which I don't think has any ultimate effect on effficiency.
You can see the small change I made to the code fragment below.

Dave Hawkes


  class object : public object_base
  {
   public:
      // default constructor creates a None object
      object();
      // explicit conversion from any C++ object to Python
      template <class T> 
      explicit object(T const& x)
          : object_base(object_initializer<is_proxy<T> ::value>::get(
                      &x, detail::convertible<object const*> ::check(&x)))
      {
      }

      // Throw error_already_set() if the handle is null.
      explicit object(handle<>  const&);

   public: // implementation detail -- for internal use only
      explicit object(detail::borrowed_reference);
      explicit object(detail::new_reference);
  };

  //
  // object_initializer -- get the handle to construct the object with,
  // based on whether T is a proxy or derived from object
  //
  template <bool is_proxy = false> 
  struct object_initializer
  {
      static PyObject*
      get(object const* x, detail::yes_convertible)
      {
          return python::incref(x-> ptr());
      }

      template <class T> 
      static PyObject*
      get(T const* x, detail::no_convertible)
      {
          return python::incref(converter::arg_to_python<T> (*x).get());
      }
  };

  template <> 
  struct object_initializer<true> 
  {
      template <class Policies> 
      static PyObject*
      get(proxy<Policies>  const* x, detail::no_convertible)
      {
          return python::incref(x-> operator object().ptr());
      }
  };
}







_______________________________________________
C++-sig mailing list
C++-sig@[...].org
http://mail.python.org/mailman/listinfo/c++-sig
Thread:
Dave Hawkes
David Abrahams
Dave Hawkes
David Abrahams
Dave Hawkes
David Abrahams
Dave Hawkes
David Abrahams
Dave Hawkes
David Abrahams
Dave Hawkes
David Abrahams

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved