Uploaded image for project: 'Swift'
  1. Swift
  2. SR-128

Pass array to variadic function

    XMLWordPrintable

    Details

      Description

      func a(p: Int...) {
          p is [Int] // true
      }
      
      a(1, 2, 3) // Works
      a([1, 2, 3]) // error: cannot invoke 'a' with an argument list of type '([Int])'
      

      I want to pass an array into a function that accepts a variadic argument, as within the scope of the function, the argument p, is treated as an array.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                arthur Arthur Sabintsev
              • Votes:
                33 Vote for this issue
                Watchers:
                37 Start watching this issue

                Dates

                • Created:
                  Updated: