简体   繁体   中英

Compiler Error C2228 in Visual Studio 2015

I'm trying to compile the webrtc code in visual studio and have run up against this error (from type_traits.h). The code is:

// 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;
};

The error is:

Error C2228 left of '.data' must have class/struct/union

  • How do I re-write this template so it compiles with the visual studio 2015 compiler?

更新visual studio 2015以更新3解决了此问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM