سؤال

على التجميع هذا الرمز:

struct any_type: boost::tuple<std::string, std::string, std::string> {
   ...
};

struct functor {
   void operator()(const std::string& v) {
      std::cout << v << std::endl;
   }
};

int main() {
   any_type type;
   boost::fusion::for_each(type, functor());
}

احصل على خطأ: لا يوجد نوع اسمه "فئة" في "struct any_type" لماذا؟ أريده أن يرث من Boost.tuple.

هل كانت مفيدة؟

المحلول

ورث من boost::fusion::tuple بدلاً من boost::tuple.
ملحوظة: النظر في صنع void operator()(const std::string& v) مقدار ثابت

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top