iwongu / sqlite3pp

SQLite3++ - C++ wrapper of SQLite3 API
MIT License
609 stars 177 forks source link

changed query_iterator to work with C++17 #59

Closed anders43 closed 5 years ago

anders43 commented 5 years ago

In C++17 (and previous) versions it is not necessary to use std::iterator as base class when doing a new iterator.

anders43 commented 5 years ago

Sorry botched up my previous pull request, haven't done anything in github before so it took some fiddling but now I know how. cheers.

iwongu commented 5 years ago

I didn't follow the changes in c++17 yet. Can you explain what's the issue of using std::iterator as base class is? Is this change okay with pre c++17?

anders43 commented 5 years ago

Hi,

When I turn on C++17 in Visual Studio and compile your code I get a warning ST4015 that says that deriving using std::iterator is no longer allowed.

See e.g. https://github.com/Tencent/rapidjson/issues/1452 [https://avatars2.githubusercontent.com/u/3337419?s=400&v=4]https://github.com/Tencent/rapidjson/issues/1452

warning STL4015: The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. · Issue #1452 · Tencent/rapidjsonhttps://github.com/Tencent/rapidjson/issues/1452 In Visual Studio 2019, Preview 2 I get: C:\SDKs\vcpkg\installed\x64-windows\include\rapidjson\document.h(110): warning C4996: 'std::iterator<std::random_access_iterator_tag,internal::MaybeAd... github.com

So I changed the code in order to no longer use std::iterator as base class and instead just declare an iterator and exposing a few property like value_type. I hope I fixed in a proper way, but as far I could see from my testing it seems to work.

BTW I like your code very much as I was looking for something to make the sqlite3 a bit more C++. Thanks for that.

I have not update the boost version of the code since I don't have boost and don't want fiddle with that at the moment, mainly because our company does not allow us to use boost (license reasons). Maybe it is an easy change there as well.

Best regards Anders.

https://twitter.com/JABKarlsson

https://twitter.com/JABKarlsson--- αη∂єяѕ кαяℓѕѕσηhttps://twitter.com/JABKarlsson (@JABKarlssonhttps://twitter.com/JABKarlsson)


From: Wongoo Lee notifications@github.com Sent: Friday, March 8, 2019 20:08 To: iwongu/sqlite3pp Cc: cyberspock; Author Subject: Re: [iwongu/sqlite3pp] changed query_iterator to work with C++17 (#59)

I didn't follow the changes in c++17 yet. Can you explain what's the issue of using std::iterator as base class is? Is this change okay with pre c++17?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fiwongu%2Fsqlite3pp%2Fpull%2F59%23issuecomment-471040918&data=02%7C01%7C%7Cdcc8c0d069c54009f3ca08d6a3f9653d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636876688865509510&sdata=6A3t1spUzy4WBwFRWFyAk65ccFyhkif%2FbMo4dfiZ78Y%3D&reserved=0, or mute the threadhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAbDhl_R4lCojJe8XlETRdGa0aqE5QPGks5vUrUVgaJpZM4bl1Jw&data=02%7C01%7C%7Cdcc8c0d069c54009f3ca08d6a3f9653d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636876688865519527&sdata=8hJxMBZfjsT29E0mq5X0A2UEqX%2BlRa64V4Jfmw0QpO0%3D&reserved=0.

anders43 commented 5 years ago

I think there is more to it, I will close this request. thanks.