Files
swift-mirror/test/Interop/Cxx/stdlib/Inputs/std-vector.h
Egor Zhdan 4acf9c8cf4 [cxx-interop] Add CxxVector protocol
This makes it possible to initialize `std::vector` from a Swift Sequence. This also conforms C++ vectors to `ExpressibleByArrayLiteral`, making it possible, for instance, to pass a Swift array to a C++ function that takes a vector of strings as a parameter.

rdar://104826995
2023-08-07 17:12:12 +01:00

16 lines
410 B
C++

#ifndef TEST_INTEROP_CXX_STDLIB_INPUTS_STD_VECTOR_H
#define TEST_INTEROP_CXX_STDLIB_INPUTS_STD_VECTOR_H
#include <vector>
#include <string>
using Vector = std::vector<int>;
using VectorOfString = std::vector<std::string>;
inline Vector initVector() { return {}; }
inline std::string takesVectorOfString(const VectorOfString &v) {
return v.front();
}
#endif // TEST_INTEROP_CXX_STDLIB_INPUTS_STD_VECTOR_H