Skip to content

Conversation

ymber
Copy link
Member

@ymber ymber commented Jun 30, 2019

Summary

SUMMARY: Infrastructure "Template read_from_json_string"

Purpose of change

I want to use read_from_json_string for a load of different quantity strings and this is more efficient than an overload for each unit type. See #31079.

Describe the solution

Use templates for read_from_json_string and move unit value vectors to appropriate classes.

Describe alternatives you've considered

Overloads for every unit type.

@ZhilkinSerg ZhilkinSerg added [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style labels Jul 1, 2019
@ZhilkinSerg ZhilkinSerg self-assigned this Jul 1, 2019
@ZhilkinSerg
Copy link
Contributor

ZhilkinSerg commented Jul 4, 2019

I guess some tests code using read_from_json_string need to be updated now:

time_duration_test.cpp: In function 'time_duration parse_time_duration(const string&)':
time_duration_test.cpp:12:27: error: 'read_from_json_string' is not a member of 'time_duration'
     return time_duration::read_from_json_string( jsin );
                           ^~~~~~~~~~~~~~~~~~~~~
make[1]: *** [Makefile:45: objwin/tiles/time_duration_test.o] Error 1

@ZhilkinSerg ZhilkinSerg removed their assignment Jul 4, 2019
@ymber ymber mentioned this pull request Jul 5, 2019
6 tasks
@ZhilkinSerg ZhilkinSerg merged commit 6ee35bc into CleverRaven:master Jul 5, 2019
@ymber ymber deleted the read_template branch July 5, 2019 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants