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

INIMap: Add User-Declared Copy Assignment Operator #28

Merged
merged 4 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# mINI <img align="left" src="icon.png?raw=true" height="96">

v0.9.14
v0.9.15

## Info

Expand Down
9 changes: 7 additions & 2 deletions src/mini/ini.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

///////////////////////////////////////////////////////////////////////////////
//
// /mINI/ v0.9.14
// /mINI/ v0.9.15
// An INI file reader and writer for the modern age.
//
///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -156,7 +156,11 @@ namespace mINI

INIMap() { }

INIMap(INIMap const& other)
INIMap(INIMap const& other) : dataIndexMap(other.dataIndexMap), data(other.data)
{
}

INIMap& operator=(INIMap const& other)
{
std::size_t data_size = other.data.size();
for (std::size_t i = 0; i < data_size; ++i)
Expand All @@ -166,6 +170,7 @@ namespace mINI
data.emplace_back(key, obj);
}
dataIndexMap = T_DataIndexMap(other.dataIndexMap);
return *this;
}

T& operator[](std::string key)
Expand Down