From: "boost-users-request@lists.boost.org" <boost-users-request@lists.boost.org>
To: boost-users@lists.boost.org
Sent:
Tuesday, 10 May 2011 4:15 PM
Subject: Boost-users Digest, Vol 2718, Issue 1
Send Boost-users mailing list submissions to
boost-users@lists.boost.orgTo subscribe or unsubscribe via the World Wide Web, visit
http://lists.boost.org/mailman/listinfo.cgi/boost-usersor, via email, send a message with subject or body 'help' to
boost-users-request@lists.boost.orgYou can reach the person managing the list at
boost-users-owner@lists.boost.orgWhen replying, please edit your Subject line so it is more specific
than "Re: Contents of Boost-users digest..."
Today's Topics:
1. Re: Error: guid_defined is not
templateBOOST_CLASS_EXPORT_GUID (Robert Ramey)
2. Re: [Boost][program-options] Original position of an argument
in command-line. (Vladimir Prus)
3. How to cast a boost::shared_ptr to void* (Mupparthy Ravindranath)
4. Re: How to cast a boost::shared_ptr to void* (Robert Jones)
5. Re: How to cast a boost::shared_ptr to void* (michi7x7)
6. Re: How to cast a boost::shared_ptr to void*
(Mupparthy Ravindranath)
7. Re: How to cast a boost::shared_ptr to void* (Robert Jones)
8. Re: [Boost][program-options] Original
position of an argument
in command-line. (Germ?n Diago)
----------------------------------------------------------------------
Message: 1
Date: Mon, 9 May 2011 21:57:06 -0800
From: "Robert Ramey" <
ramey@rrsd.com>
To:
boost-users@lists.boost.orgSubject: Re: [Boost-users] Error: guid_defined is not
templateBOOST_CLASS_EXPORT_GUID
Message-ID: <iqagie$sbh$
1@dough.gmane.org>
Jari wrote:
> Hi
> I am using boost serialization and it was working fine (save load
> works) but then I tried using BOOST_CLASS_EXPORT_GUID and get weird
> error.
>
> The line that gives the error is this:
>
>
BOOST_CLASS_EXPORT_GUID( Bakery, "Bakery")
>
>
> (I put the code in Cpp to avoid any problems with headers.)
>
>
> And this is the full Visual studio express 2010 error:
>
> 2>E:\boost_1_46_1\boost/archive/detail/check.hpp(162): error C2338:
> typex::value
...
what does the code look like at line 162 of check.hpp ?
Robert Ramey
------------------------------
Message: 2
Date: Tue, 10 May 2011 10:45:04 +0400
From: Vladimir Prus <
vladimir@codesourcery.com>
To:
boost-users@lists.boost.orgSubject: Re: [Boost-users] [Boost][program-options] Original position
of an argument in command-line.
Message-ID:
<iqamtg$nvf$
1@dough.gmane.org>
Content-Type: text/plain; charset="UTF-8"
Germ?n Diago wrote:
> Hi all. I have a question regarding boost.program_options.
>
> I want to parse a command-line but I want to know the order in which
> each option appeared in the
> command line. Is this possible? Thanks in advance.
parse_command_line returns vector< basic_option<charT> >, which
are in the order of occurence. This is a point where you can do
logic based on the order. variables_map does not store order
information.
HTH,
--
Vladimir Prus
Mentor Graphics
+7 (812) 677-68-40
------------------------------
Message: 3
Date: Tue, 10 May 2011 13:26:09 +0530 (IST)
From: Mupparthy Ravindranath <
rv_nath@yahoo.com>
To: "
boost-users@lists.boost.org" <
boost-users@lists.boost.org>
Subject: [Boost-users] How to cast a boost::shared_ptr to void*
Message-ID: <
257490.53596.qm@web94803.mail.in2.yahoo.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi all,
My requirement is to cast an object of type shared_ptr as void*, so that I can send it to a callback function that accepts a void*.? I cannot change callback the function signature because it is part of an existing legacy code.
In the existing code, I am sending a raw object pointer (instead of shared_ptr).?
Now, if I want to pass a shared_ptr, it won't compile because I cannot cast the shared ptr to void*.?
Can anyone suggest some workaround for this.? I tried searching the mailing lists and internet, but not much luck.
regards,
RV
-------------- next part --------------
HTML attachment scrubbed and removed
------------------------------
Message: 4
Date: Tue, 10 May 2011 09:01:05 +0100
From: Robert Jones <
robertgbjones@gmail.com>
To:
boost-users@lists.boost.orgSubject: Re: [Boost-users] How to cast a boost::shared_ptr to void*
Message-ID: <
BANLkTin7kyBhUYAVuhm5jWAX_goA3fUO0w@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
On Tue, May 10, 2011 at 8:56 AM, Mupparthy Ravindranath
<
rv_nath@yahoo.com>wrote:
> Hi all,
>
> My requirement is to cast an object of type shared_ptr as void*, so that I
> can send it to a callback function that accepts a void*. I cannot change
> callback the function signature because it is part of an existing legacy
> code.
>
> In the existing code, I am sending a raw object pointer (instead of
> shared_ptr). Now, if I want to pass a shared_ptr, it won't compile because
> I cannot cast the shared ptr to void*.
>
> Can anyone suggest some workaround for this. I tried searching the mailing
>
lists and internet, but not much luck.
>
>
>
struct X { };
boost::shared_ptr<X> p;
void f( void *);
f( p.get( ) );
should do it. But beware the pointee may be deleted if the last copy of the
shared pointer
goes out of scope, as the raw pointer won't have incremented the reference
count.
- Rob.
-------------- next part --------------
HTML attachment scrubbed and removed
------------------------------
Message: 5
Date: Tue, 10 May 2011 10:06:40 +0200
From: michi7x7 <
mailing-lists@michi7x7.de>
To:
boost-users@lists.boost.orgSubject: Re: [Boost-users] How to cast a boost::shared_ptr to void*
Message-ID: <
4DC8F210.5090200@michi7x7.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> Hi all,
Hi
> My requirement is to cast an object of type shared_ptr as void*, so that
> I can send it to a callback function that accepts a void*. I cannot
> change callback the function signature because it is part of an existing
> legacy code.
>
You can get the raw-pointer using the member-function get() or the free
function get_pointer (which should be prefered).
smart_ptr<Class> ptr(new Class);
Class * raw_ptr = get_pointer(ptr);
You can cast the raw-pointer to void* of course.
--
Best regards,
michi7x7
------------------------------
Message: 6
Date: Tue, 10 May 2011 14:24:26 +0530 (IST)
From: Mupparthy Ravindranath <
rv_nath@yahoo.com>
To: "
boost-users@lists.boost.org" <
boost-users@lists.boost.org>
Subject: Re: [Boost-users] How to cast a boost::shared_ptr to void*
Message-ID: <
443447.3562.qm@web94809.mail.in2.yahoo.com>
Content-Type: text/plain; charset="iso-8859-1"
Sorry for the spam.? I got the answer, how to do it. Ignore my previous mail.
[quote]
#include <boost/shared_ptr.hpp>
#include <iostream>
using namespace std;
class A {
??? public:
??? void hello () { cout << "Hello, friends...!" << endl; }
};
typedef
boost::shared_ptr<A> APtr;
void* callbk (void* o) {
??? APtr a = *static_cast<APtr*>(o);
??? a->hello();
}
int main() {
A* rawPtr = new A;
boost::shared_ptr<A>sPtr(rawPtr);
callbk((void*)&sPtr);
return 0;
}
[/quote]
warm regars,
RV
________________________________
From: Mupparthy Ravindranath <
rv_nath@yahoo.com>
To: "
boost-users@lists.boost.org" <
boost-users@lists.boost.org>
Sent: Tuesday, 10 May 2011 1:26 PM
Subject: How to cast a boost::shared_ptr to void*
Hi all,
My requirement is to cast an object of type shared_ptr as void*, so that I can send it to a
callback function that accepts a void*.? I cannot change callback the function signature because it is part of an existing legacy code.
In the existing code, I am sending a raw object pointer (instead of shared_ptr).? Now, if I want to pass a shared_ptr, it won't compile because I cannot cast the shared ptr to void*.?
Can anyone suggest some workaround for this.? I tried searching the mailing lists and internet, but not much luck.
regards,
RV
-------------- next part --------------
HTML attachment scrubbed and removed
------------------------------
Message: 7
Date: Tue, 10 May 2011 10:17:30 +0100
From: Robert Jones <
robertgbjones@gmail.com>
To:
boost-users@lists.boost.orgSubject: Re: [Boost-users] How to
cast a boost::shared_ptr to void*
Message-ID: <
BANLkTikigCKTy4ROQD7wydmeNGuT4_e6Kw@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
On Tue, May 10, 2011 at 9:54 AM, Mupparthy Ravindranath
<
rv_nath@yahoo.com>wrote:
> Sorry for the spam. I got the answer, how to do it. Ignore my previous
> mail.
>
> [quote]
> #include <boost/shared_ptr.hpp>
> #include <iostream>
> using namespace std;
>
> class A {
> public:
> void hello () { cout << "Hello, friends...!" << endl; }
> };
>
> typedef boost::shared_ptr<A> APtr;
>
> void* callbk (void* o)
{
> APtr a = *static_cast<APtr*>(o);
> a->hello();
> }
>
> int main() {
> A* rawPtr = new A;
> boost::shared_ptr<A>sPtr(rawPtr);
> callbk((void*)&sPtr);
> return 0;
> }
> [/quote]
>
>
Not like that! That passes the address of the shared pointer, not the
address of your
new'd object. If it works it's by luck!
- R.
-------------- next part --------------
HTML attachment scrubbed and removed
------------------------------
Message: 8
Date: Tue, 10 May 2011 12:45:03 +0200
From: Germ?n Diago <
germandiago@gmail.com>
To:
boost-users@lists.boost.orgSubject: Re: [Boost-users] [Boost][program-options] Original
position
of an argument in command-line.
Message-ID: <BANLkTinL0zUharoHtZJeOFxz6D=
eo6_6WQ@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
> parse_command_line returns vector< basic_option<charT> >, which
> are in the order of occurence. This is a point where you can do
> logic based on the order. variables_map does not store order
> information.
Thanks! Very useful!
------------------------------
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.orghttp://lists.boost.org/mailman/listinfo.cgi/boost-usersEnd of Boost-users
Digest, Vol 2718, Issue 1
********************************************