struct与class不一样!!!

base.hpp

#ifndef _BASE_
#define _BASE_
#include <tuple>
#include <iostream>



template <typename... T>
struct  base
{
   std::tuple<T...> values_;
};

#endif

server.hpp

#ifndef _SERVER_
#define _SERVER_
#include "base.hpp"
#include <utility>

class server{
public:
    virtual ~server();
    struct data : base<int , float ,char >
    {
        data(){
            std::get<0>(values_) = 0;
        }

        data(int a, float b, char c){
            std::get<0>(values_) = a;
            std::get<1>(values_) = b;
            std::get<2>(values_) = c;
        }
    };
     
};

#endif

main.cpp

#include "server.hpp"


int main()
{
    server::data a;
    
}

猜你喜欢

转载自blog.csdn.net/weixin_37597675/article/details/89226521