Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Bool CArchive

Bool CArchive

Scheduled Pinned Locked Moved C / C++ / MFC
questioncsharpc++visual-studiohelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Li Mu Bai
    wrote on last edited by
    #1

    Hi guys, In VS 6 C++ there was no Bool CArchive Operator so we made one of our own where it used an int for true = 1 false = 0, naturally. Now I see .NET C++ they have been clever and added one of their own, how can I disable that and use my own without having to derive a class from CArchive and overloading it?? I would be interested to hear if anyone else has this problem The Wudan Master

    J 1 Reply Last reply
    0
    • L Li Mu Bai

      Hi guys, In VS 6 C++ there was no Bool CArchive Operator so we made one of our own where it used an int for true = 1 false = 0, naturally. Now I see .NET C++ they have been clever and added one of their own, how can I disable that and use my own without having to derive a class from CArchive and overloading it?? I would be interested to hear if anyone else has this problem The Wudan Master

      J Offline
      J Offline
      Joaquin M Lopez Munoz
      wrote on last edited by
      #2

      I guess you defined your homemade operator as a global CArchive& operator<<(CArchive& ar,bool b), right? If so, and if you can afford some syntax ugliness, you can force selection of this operator instead of the built-in one by calling it explicitly like this:

      CArchive ar;
      ...
      operator<<(ar,true); //in isolated form
      operator<<(ar<<1<<2,false)<<3<<4; //inside a chain, outputs 12034

      Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

      L 1 Reply Last reply
      0
      • J Joaquin M Lopez Munoz

        I guess you defined your homemade operator as a global CArchive& operator<<(CArchive& ar,bool b), right? If so, and if you can afford some syntax ugliness, you can force selection of this operator instead of the built-in one by calling it explicitly like this:

        CArchive ar;
        ...
        operator<<(ar,true); //in isolated form
        operator<<(ar<<1<<2,false)<<3<<4; //inside a chain, outputs 12034

        Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

        L Offline
        L Offline
        Li Mu Bai
        wrote on last edited by
        #3

        Thanks Joaquín M López Muñoz it works for me:laugh: :laugh: The wudan Master

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups