Created
March 21, 2012 00:17
-
-
Save carlobaldassi/2142899 to your computer and use it in GitHub Desktop.
julia: problematic convesion to Vector{Tuple}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typealias MyTuple (ASCIIString, BitsKind) | |
type MyType | |
some_field::Int | |
function MyType(vec::Vector{MyTuple}) | |
println("INNER") | |
new(0) | |
end | |
end | |
function MyType(vec) | |
println("OUTER") | |
println(" eltype pre=$(eltype(vec))") | |
c_vec = convert(Vector{MyTuple}, vec) ## this conversion doesn't work! | |
println(" eltype post=$(eltype(c_vec))") | |
MyType(c_vec) | |
end | |
some_data = [("a", Int32), ("b", Int32)] | |
some_c_data = convert(Vector{MyTuple}, some_data) ## conversion works here | |
ex_c_data = MyType(some_c_data) ## <- this works | |
#ex_data = MyType(some_data) ## <- this keeps calling the | |
## outer constructor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment