Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   invalid conversion from ‘ProbeInfo_t**’ to ‘int’ (http://www.velocityreviews.com/forums/t806186-invalid-conversion-from-probeinfo_t-to-int.html)

Michael 11-22-2011 11:39 AM

invalid conversion from ‘ProbeInfo_t**’ to ‘int’
 
list<int> myProbelist;

for( int probeA = 0; probeA < 100; probeA++)
{
ProbeInfo_t* tmpInfo = new ProbeInfo_t();
tmpInfo->structSize = sizeof( tmpInfo );
myProbelist.push_back( &tmpInfo );
....


Hi, doing as above I get:

- Invalid arguments ' Candidates are: void push_back(const int &) '
- invalid conversion from ‘ProbeInfo_t**’ to ‘int’
- initializing argument 1 of ‘void std::list<_Tp,
_Alloc>::push_back(const _Tp&) [with _Tp = int, _Alloc =

Probeinfo is a struct. Many thanks
Michael


Fred Zwarts \(KVI\) 11-22-2011 12:14 PM

Re: invalid conversion from ‘ProbeInfo_t**’ to ‘int’
 
"Michael" wrote in message
news:b3403$4ecb89d5$c299b7f6$19875@news.hispeed.ch ...
>
>list<int> myProbelist;
>
>for( int probeA = 0; probeA < 100; probeA++)
>{
>ProbeInfo_t* tmpInfo = new ProbeInfo_t();


tmpInfo is a pointer of type ProbeInfo_t*

>tmpInfo->structSize = sizeof( tmpInfo );


You store the size of the pointer (usually 4 on 32-bit and 8 on 64-bit
platforms) somewhere.

>myProbelist.push_back( &tmpInfo );


You try to store the address of the pointer.
This address has type ProbeInfo_t**

>...
>
>
>Hi, doing as above I get:
>
>- Invalid arguments ' Candidates are: void push_back(const int &) '
>- invalid conversion from ‘ProbeInfo_t**’ to ‘int’


That's the type I explained above.

>- initializing argument 1 of ‘void std::list<_Tp, _Alloc>::push_back(const
>_Tp&) [with _Tp = int, _Alloc =
>
>Probeinfo is a struct. Many thanks
>Michael


There is no question, so is there a problem?


SG 11-22-2011 12:26 PM

Re: invalid conversion from ‘ProbeInfo_t**’ to ‘int’
 
On 22 Nov., 12:39, Michael wrote:
>
> list<int> myProbelist;
>
> for( int probeA = 0; probeA < 100; probeA++)
> * {
> ProbeInfo_t* tmpInfo = new ProbeInfo_t();
> tmpInfo->structSize = sizeof( tmpInfo );
> myProbelist.push_back( &tmpInfo );
> ...
>
> Hi, doing as above I get:
>
> - Invalid arguments 'Candidates are: void push_back(const int &)'
> - invalid conversion from ProbeInfo_t** to int
> - initializing argument 1 of void std::list<_Tp,
> _Alloc>::push_back(const _Tp&) [with _Tp = int, _Alloc =
>
> Probeinfo is a struct. Many thanks
> Michael


- Help! If I stick a fork into my leg it'll hurt. I got the fork
from WMF. Many thanks. Michael.

- Well, of course it'll hurt ... unless your nerves are damaged
somehow. What did you expect? What is the point of sticking the
fork into your leg? You obviously don't want it to hurt. That
much is clear.

SG


All times are GMT. The time now is 04:11 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.