Unified Call Syntax n4165
Hacker news: A bit of background for the unified C++ call proposal (isocpp.org)
Uniform Function Call Syntax (RUST / D)
reddit: C++17 unified call syntax concern
Hacker news: A bit of background for the unified C++ call proposal (isocpp.org)
Uniform Function Call Syntax (RUST / D)
reddit: C++17 unified call syntax concern
#include <iostream>
#include <memory>
#include <boost/serialization/strong_typedef.hpp>
using namespace std;
// act like golang package.
namespace NS1{
struct Fun{
int a{0}; // zero init like in golang
};
// golang style method
void run(Fun* f, int){
std::cout << f->a << std::endl;
}
};
using namespace NS1;
void run(NS1::Fun*){
cout << "run int" << endl;
}
int main(){
run(unique_ptr<Fun>(new Fun{38}).get(), 42);
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.