i'm updating my variant type - Page 2
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22

Thread: i'm updating my variant type

  1. #16
    Join Date
    Apr 1999
    Posts
    27,444

    Re: i'm updating my variant type

    Quote Originally Posted by Cambalinho View Post
    sorry i want avoid the boost::any i have tested.
    But to do anything that you desire you do have to come up with something similar in design to boost::any. Playing simplistic games with a "dumb" type as a void pointer isn't going to accomplish this goal.

    Regards,

    Paul McKenzie

  2. #17
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,746

    Re: i'm updating my variant type

    At a high level, could you describe what you are trying to achieve? Some guru's guru may be able to provide guidance on design etc.
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  3. #18
    Join Date
    Apr 2009
    Posts
    719

    Re: i'm updating my variant type

    Quote Originally Posted by 2kaud View Post
    At a high level, could you describe what you are trying to achieve? Some guru's guru may be able to provide guidance on design etc.
    that my variant accept any type vector\arrays\class names\struct\union\others, and use it directly(i mean just the var name(variant type) in cout) instead use static_cast way. that's why i give up with boost::any.

  4. #19
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,746

    Re: i'm updating my variant type

    Yes, but why do you want to do this - what are you trying to accomplish? c++ is a typed language.
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  5. #20
    Join Date
    Apr 2009
    Posts
    719

    Re: i'm updating my variant type

    Quote Originally Posted by 2kaud View Post
    Yes, but why do you want to do this - what are you trying to accomplish? c++ is a typed language.
    yes it is but:
    - the void pointer\boost::any needs the static_cast way for used in cout;
    - i like be more simple\direct;
    - and you know that i need it...
    sorry if these don't make sence to some programmers, but i need these new type

  6. #21
    Join Date
    Apr 1999
    Posts
    27,444

    Re: i'm updating my variant type

    Quote Originally Posted by Cambalinho View Post
    yes it is but:
    - the void pointer\boost::any needs the static_cast way for used in cout;
    Because that's how C++ works. If what you wanted could be done, don't you think it would have been done already? If you don't like the fact that the user of the void pointer must know before-hand what to convert it to, then choose another language.

    I already mentioned to you that there is no way for anyone to know for sure what a void pointer points to, thereby know what type of cast to use. If I give you a void pointer and no other information, you cannot convert it to another type safely unless you also know what it points to. Again, that's how C++ works.
    - i like be more simple\direct;
    - and you know that i need it...
    sorry if these don't make sence to some programmers, but i need these new type
    You still didn't answer the question -- why do you need to do this? C++ is not designed to do this, where an "any" type can be passed around and everyone knows what the "any" is really pointing to.

    It seems that with all of your posts, including this thread, you're trying to turn C++ into another language instead of actually developing applications using C++.

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; November 29th, 2013 at 04:55 PM.

  7. #22
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,746

    Re: i'm updating my variant type

    you're trying to turn C++ into another language instead of actually developing applications using C++.
    IMO he is. He's mentioned his 'new language' from almost his very first post in these forums. I thought he was going to write a compiler/interpreter in c++ for this language. But it seems the plan is to turn c++ itself into this 'language'. I'm not convinced this is possible never mind feasible.
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center