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. how to convert vector of doubles to a variant type

how to convert vector of doubles to a variant type

Scheduled Pinned Locked Moved C / C++ / MFC
c++graphicshelptutorialquestion
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.
  • B Offline
    B Offline
    b rad311
    wrote on last edited by
    #1

    Hi everyone, Can anyone tell me how to convert a vector (of doubles) to a variant? I am receiving the following error message from vc++ 2008:

    error C2664: 'CiPlotChannelX::AddXYArrays' : cannot convert parameter 1 from 'std::vector<_Ty>' to 'const VARIANT &'

    I have close to 1 million values so I'm trying to avoid any "for" loops. Thanks!

    C 1 Reply Last reply
    0
    • B b rad311

      Hi everyone, Can anyone tell me how to convert a vector (of doubles) to a variant? I am receiving the following error message from vc++ 2008:

      error C2664: 'CiPlotChannelX::AddXYArrays' : cannot convert parameter 1 from 'std::vector<_Ty>' to 'const VARIANT &'

      I have close to 1 million values so I'm trying to avoid any "for" loops. Thanks!

      C Offline
      C Offline
      Code o mat
      wrote on last edited by
      #2

      Never needed to do this but i read somewhere that you can use CComSafeArray[^] to get a variant, or something that you can use with variant from an array. I think you need to wrap your array into this CComSafeArray thing (it is a template i believe) and then use Detach or maybe it's LPSAFEARRAY operator to get a SAFEARRAY wich can be used with VARIANT.

      > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Computers don't kill programs, users kill programs < > "It doesn't work, fix it" does not qualify as a bug report. <

      B 1 Reply Last reply
      0
      • C Code o mat

        Never needed to do this but i read somewhere that you can use CComSafeArray[^] to get a variant, or something that you can use with variant from an array. I think you need to wrap your array into this CComSafeArray thing (it is a template i believe) and then use Detach or maybe it's LPSAFEARRAY operator to get a SAFEARRAY wich can be used with VARIANT.

        > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Computers don't kill programs, users kill programs < > "It doesn't work, fix it" does not qualify as a bug report. <

        B Offline
        B Offline
        b rad311
        wrote on last edited by
        #3

        ok, thanks. I'll look into this.

        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