C++ Tuple vs Struct

后端 未结 12 1828
耶瑟儿~
耶瑟儿~ 2020-12-07 10:51

Is there is any difference between using a std::tuple and a data-only struct?

typedef std::tuple foo_t;

s         


        
12条回答
  •  长情又很酷
    2020-12-07 11:45

    There shouldn't be a performance difference (even an insignificant one). At least in the normal case, they will result in the same memory layout. Nonetheless, casting between them probably isn't required to work (though I'd guess there's a pretty fair chance it normally will).

提交回复
热议问题