【发布时间】:2018-11-29 01:23:08
【问题描述】:
此问题的代码 sn-p 来自 EOS 的 WIKI 文档的 Persistance API 部分。此页面的链接在这里...
https://github.com/EOSIO/eos/wiki/Persistence-API
在下面的代码 sn-p 中,看起来类模板(或模板类)被 typedef 为 service_table_type。然后一大堆自定义类型在类模板的尖括号中传递,除了复杂性之外似乎没有什么新东西(如果我理解正确的话)。
using service_table_type = multi_index<service, service_rec,
indexed_by< N(bycustomer), const_mem_fun<service_rec, account_name,
&service_rec::get_customer>>>;
我的问题是关于上面代码 sn-p 之后的下面一行代码。这里发生了什么?它看起来像是对函数 service_table() 的调用,该函数返回一个 service_table_type 类型的参数。这个函数是从哪里来的?如果这个函数来自一个库,它如何返回我们任意创建的 service_table_type 类型的值?
service_table_type service_table( current_receiver(), mechanic );
您能否提供一个精简的通用代码示例来说明这里发生了什么?
谢谢!
【问题讨论】:
标签: c++ templates boost-multi-index eos