I am puzzled about the use of the C++ standard library after importing CxxStdlib.
I tried variations on the following two statements and received variations of errors; one of which is shown below.
My question is, what syntax is needed to access the C++ standard library?
And specifically, how can I access std.vector directly from Swift after importing CxxStdlib?
import CxxStdlib
std.vector(std.Int32,8)
Error Message:
'std.__1.vector<_Tp, _Alloc>' cannot be constructed because it has no accessible initializers
I sincerely appreciate the response.
I've been experimenting with the typedef, and a variety of other variations on the syntax, but so far have not discovered anything that works. My latest effort has the following in the .hpp file.
std::vector v1 ( 8, 888 );
using ...
typedef vector v1;
did not get me to anything that worked in Swift
Adding code in main.swift returned a variety of errors including a duplicate symbol error.
var v11 = Int(v1.capacity())
print("v11 = (v11) ")
So far, no syntax has returned an element of the vector.
I'm trying to figure out the same thing. So far I have in my header: typedef std::vector<char> CharVector;
Which allows me to use CharVector in my Swift code using something like: let vec = CharVector(5, CharVector.allocator_type())
My problem is I want to use the #5 constructor form, with signature: template< class InputIt > vector( InputIt first, InputIt last, const Allocator& alloc = Allocator() );
I can't figure out how to use this form.