Files
swift-mirror/test/Interop/Cxx/stdlib/Inputs/std-vector.h
Egor Zhdan c26fe86754 [cxx-interop] Make automatic conformances work with the bridging header
For C++ types that are defined in the bridging header, or are `#include`-d from the bridging header, we did not generate the automatic conformances to `CxxSequence`, `CxxRandomAccessCollection` protocols.

To check whether we should try to conform a C++ type to those protocols, the compiler checks for the presence of `requires cplusplus` in the module declaration in a modulemap file. This check is there to prevent us from accidentally pulling in `Cxx`/`CxxStdlib` modules when a client is importing a C library.

This change makes sure those conformances are generated.

rdar://121927459
2024-01-31 13:56:18 +00:00

26 lines
580 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();
}
class VectorSubclass: public Vector {
public:
};
class VectorOfStringSubclass : public std::vector<std::string> {
public:
using std::vector<std::string>::vector;
};
#endif // TEST_INTEROP_CXX_STDLIB_INPUTS_STD_VECTOR_H