Switch statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gwenky
    New Member
    • Feb 2008
    • 10

    Switch statement

    Can a switch statement be static_cast'ed to become an int from a double?

    Thanks....
  • oler1s
    Recognized Expert Contributor
    • Aug 2007
    • 671

    #2
    Can a switch statement be static_cast'ed to become an int from a double?
    Sorry, but I can't translate this question into anything meaningful. You just asked how to use static_cast to convert a switch statement from an int to a double. ...

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Originally posted by gwenky
      Can a switch statement be static_cast'ed to become an int from a double?

      Thanks....
      Expressions have values that can be casted; statements don't have a value and
      the switch statement isn't an expression.

      kind regards,

      Jos

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        I think the OP wants to switch based on a double rather than an int.

        If this is the case, the answer is no. You can switch only on a integer value.

        Comment

        • gwenky
          New Member
          • Feb 2008
          • 10

          #5
          Thanks, that was what I was wondering. Sorry I did not enter my question very clearly.

          Comment

          Working...