Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"type_string" output of vector #29

Closed
84356813 opened this issue Sep 12, 2016 · 3 comments
Closed

"type_string" output of vector #29

84356813 opened this issue Sep 12, 2016 · 3 comments

Comments

@84356813
Copy link

84356813 commented Sep 12, 2016

`#include

include <silicon/api.hh>

include <silicon/api_description.hh>

include "symbols.hh"

using namespace sl; // Silicon namespace
using namespace s; // Symbols namespace

int main()
{
typedef decltype(D(_name = std::string(), _age = int(), _city = std::string())) User;

User u("John", 23, "NYC");
std::vector<User> ul;
ul.push_back(u);
std::cout << "-----type_string(User)-----" <<std::endl;
std::cout << type_string( &u ) <<std::endl;
std::cout << "-----type_string(std::vector<user>)-----" <<std::endl;
std::cout << type_string( &ul ) <<std::endl;

return 0;

}`

out put :

-----type_string(User)-----
{name: string, age: int, city: string}
-----type_string(std::vector<user>)-----
vector of void

Is there some way to make "type_string(std::vector*)" to output "vector of {name: string, age: int, city: string}"

@matt-42
Copy link
Owner

matt-42 commented Sep 12, 2016

It should work now: 9741159#diff-60cb1e143f8c8fa9e4aca20cab1f6a50R36

@84356813
Copy link
Author

84356813 commented Sep 18, 2016

it works,but not so well.
`#include

#include <silicon/api.hh>
#include <silicon/api_description.hh>

#include "symbols.hh"

using namespace sl; // Silicon namespace
using namespace s; // Symbols namespace

int main()
{
typedef decltype(D(_name = std::string(), _age = int(), _city = std::string())) User;

User u("John", 23, "NYC");
std::vector<User> ul;
ul.push_back(u);
auto x = D(_num=1,_date=ul);
std::cout << "-----type_string(User)-----" <<std::endl;
std::cout << type_string( &u ) <<std::endl;
std::cout << "-----type_string(std::vector<user>)-----" <<std::endl;
std::cout << type_string( &ul ) <<std::endl;
std::cout << "-----type_string(D(_num=int(1),_date=std::vector<user>()))-----" <<std::endl;
std::cout << type_string(&x) <<std::endl;
return 0;

}
`
out put:

`-----type_string(User)-----

{name: string, age: int, city: string}

-----type_string(std::vector)-----

vector of {name: string, age: int, city: string}

-----type_string(D(_num=int(1),_date=std::vector()))-----

{num: int, date: vector of void}

`
when a vector nesting in a sio, it does not work again;

@matt-42
Copy link
Owner

matt-42 commented Sep 19, 2016

Thanks for noticing. Fixed in e54e174

@matt-42 matt-42 closed this as completed Sep 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants