Issue
If I have some existing struct, but I want to use "Reference" behavior, how do I achieve that?
I can write some simple class-holder like
class Box<T> {
var value: T
init(_ value: T) {
self.value = value
}
}
I guess there must be ready class in the standard library, but I didn't find it.
I want to store that reference in my class, so inout parameter isn't what I need.
Solution
For me the best variant was using class-holder:
class Ref<T> {
var value: T
init(_ value: T) {
self.value = value
}
}
Answered By - vbezhenar Answer Checked By - Senaida (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.