Re: how to pass smart pointes to function.
From: John Harrison (john_andronicus_at_hotmail.com)
Date: 07/08/04
- Next message: Christopher Benson-Manica: "Re: Friend a good idea here?"
- Previous message: Victor Bazarov: "Re: how to pass smart pointes to function."
- In reply to: lokb: "how to pass smart pointes to function."
- Next in thread: Phlip: "Re: how to pass smart pointes to function."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 08 Jul 2004 21:23:12 +0100
On Thu, 08 Jul 2004 16:06:29 -0400, lokb <lokeshbabu_ms@rediffmail.com>
wrote:
> Hi,
> I have a structure which and defined a smart pointer to the structure.
>
> /* Structure of Begin Document Index Record */
> typedef struct BDI_Struct{
> unsigned char rname;
> unsigned short int rlen;
> int code;
> short int reserved;
> char indexName[9];
> unsigned char tripLen;
> unsigned char tripCode;
> TRIPLET01 t01;
> }BDIStruct;
>
> /* Structure of Index Element Record */
> typedef struct record{
> unsigned char rname;
> unsigned short int rlen;
> int code;
> short int reserved;
> unsigned char tripLen;
> unsigned char tripCode;
> union
> {
> TRIPLET01 t01;
> TRIPLET57 t57;
> TRIPLET2D t2D;
> TRIPLET36 t36;
> TRIPLET02 t02;
> TRIPLET80 t80;
> TRIPLETGEN tgen;
> }TRec;
> }IndexStruct;
>
> Defined the smart pointer as below:
> where ObjVar returns the pointer.
> typedef ObjVar<IELStruct> IELStruct_sptr;
> typedef ObjVar<BDIStruct> BDIStruct_sptr;
>
> Now when i am passing the smart pointers to the function i get
> compilation
> errors
> I am passing the smart pointers as
>
> int vValidateIndModcaFile(ObjVar<BDIStruct>& bdirec,ObjVar<IndexStruct>&
> ielrec);
>
> Is it the right way to pass the smart pointers.
>
> Could you plz guide me.
>
> I am getting the erros like
>
> "/vpapp/accenture/ISIXRelease1206302004/include/sptr.hpp", line 68.11:
> 1540-1101 (W) A return value of type "BDI_Struct *" is expected.
> "/vpapp/accenture/ISIXRelease1206302004/include/sptr.hpp", line 63.12:
> 1540-0700 (I) The previous message was produced while processing
> "ObjVar<BDI_Struct>::operator->()".
> "IndOutModcaParser.cpp", line 1814.5: 1540-0700 (I) The previous message
> was produced while processing
> "CIndOutModcaParser::vValidateIndModcaFile(ObjVar<BDI_Struct> &,
> ObjVar<record> &)".
> "/vpapp/accenture/ISIXRelease1206302004/include/sptr.hpp", line 68.11:
> 1540-1101 (W) A return value of type "record *" is expected.
> "/vpapp/accenture/ISIXRelease1206302004/include/sptr.hpp", line 63.12:
> 1540-0700 (I) The previous message was produced while processing
> "ObjVar<record>::operator->()".
> "IndOutModcaParser.cpp", line 1814.5: 1540-0700 (I) The previous message
> was produced while processing
> "CIndOutModcaParser::vValidateIndModcaFile(ObjVar<BDI_Struct> &,
> ObjVar<record> &)"
>
> Thanks,
> Lokb
>
Without seeing the defintion of ObjVar it seems impossible to answer your
question about how to use it. Smart pointers are classes just like any
other, how you use them depends on how they are written.
What you have written would certainly work with some smart pointer classes
I have seen, but why it isn't OK with your smart pointer can only be
guessed at without seeing the code of your smart pointer class.
john
- Next message: Christopher Benson-Manica: "Re: Friend a good idea here?"
- Previous message: Victor Bazarov: "Re: how to pass smart pointes to function."
- In reply to: lokb: "how to pass smart pointes to function."
- Next in thread: Phlip: "Re: how to pass smart pointes to function."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|