0
我試圖在visual studio中編譯webrtc代碼,並且運行了這個錯誤(來自type_traits.h)。該代碼是:Visual Studio 2015中的編譯器錯誤C2228
// Determines if the given class has zero-argument .data() and .size() methods
// whose return values are convertible to T* and size_t, respectively.
template <typename DS, typename T>
class HasDataAndSize {
private:
template <
typename C,
typename std::enable_if<
std::is_convertible<decltype(std::declval<C>().data()), T*>::value &&
std::is_convertible<decltype(std::declval<C>().size()), std::size_t>::value>::type* = nullptr>
static int Test(int);
template <typename>
static char Test(...);
public:
static constexpr bool value = std::is_same<decltype(Test<DS>(0)), int>::value;
};
的錯誤是:
錯誤C2228左「數據」必須有類/結構/聯合
- 如何重新寫這個模板所以它用visual studio 2015編譯器編譯?
你或(webrtc)是如何使用這個類的?錯誤發生在哪裏? –
簡單地粘貼精確的代碼(並添加'#include')在VS2015中編譯得很好。也許其他一些代碼正在妨礙你的發展? –
KompjoeFriek
有什麼可以做的呢?一些編譯器選項? – Sean