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. ATL / WTL / STL
  4. Why not to use Smart types in a container?

Why not to use Smart types in a container?

Scheduled Pinned Locked Moved ATL / WTL / STL
dockerquestion
5 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.
  • P Offline
    P Offline
    paresh_joe
    wrote on last edited by
    #1

    Some coding standards at my end says that, Do not use smart types in a container? Does anyone know reason for this?

    P 1 Reply Last reply
    0
    • P paresh_joe

      Some coding standards at my end says that, Do not use smart types in a container? Does anyone know reason for this?

      P Offline
      P Offline
      paresh_joe
      wrote on last edited by
      #2

      Any extra things that one has to consider while using this?

      F 1 Reply Last reply
      0
      • P paresh_joe

        Any extra things that one has to consider while using this?

        F Offline
        F Offline
        followait
        wrote on last edited by
        #3

        When copying container auto_ptr will incur problems. No problem with shared_ptr. I'm using shared_ptr in a vector now. :)

        system

        P 1 Reply Last reply
        0
        • F followait

          When copying container auto_ptr will incur problems. No problem with shared_ptr. I'm using shared_ptr in a vector now. :)

          system

          P Offline
          P Offline
          paresh_joe
          wrote on last edited by
          #4

          Thanks for the answer. but my other question is e.g. what care needs to be taken if i use _bstr_t in a vector?

          F 1 Reply Last reply
          0
          • P paresh_joe

            Thanks for the answer. but my other question is e.g. what care needs to be taken if i use _bstr_t in a vector?

            F Offline
            F Offline
            followait
            wrote on last edited by
            #5

            _bstr_t is like shared_ptr, it can be copied, but there is a problem about the semantic: For example, 1. let vecotr a contain some _bstr_t pointers, 2. copy a to b 3. get some pointer in b, and changed the object through the pointer, think what about a. I think it is not the semantic of copy.

            system

            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