Comments (5)
It wasn't designed to work as an input_iterator
, no. But if you have a use for it, that helps. Did the error say by any chance exactly which requirements were not satisfied?
I deliberately kept the iterator class out of view so I'd have elbow room for a future better implementation. I was thinking perhaps as a generator, but we'll see. Main thing is that it should perform well.
from libpqxx.
Compiling the following code:
#include <pqxx/pqxx>
#include <ranges>
int main()
{
auto connection = pqxx::connection{""};
auto tx = pqxx::work{connection};
auto stream = tx.stream<int>("");
using iterator = decltype(stream.begin());
// using sentinel = decltype(stream.end());
std::input_iterator auto it = stream.begin();
//std::sentinel_for<iterator> auto end = stream.end();
}
the requirement is not satisfied here:
/usr/include/c++/13.2.1/concepts:139:13: required for the satisfaction of ‘assignable_from<_Tp&, _Tp>’ [with _Tp = pqxx::internal::stream_query_input_iterator<int>]
...
/usr/include/c++/13.2.1/concepts:142:10: in requirements with ‘_Lhs __lhs’, ‘_Rhs&& __rhs’ [with _Lhs = pqxx::internal::stream_query_input_iterator<int>&; _Rhs = pqxx::internal::stream_query_input_iterator<int>]
/usr/include/c++/13.2.1/concepts:143:17: note: the required expression ‘__lhs = static_cast<_Rhs&&>(__rhs)’ is invalid
143 | { __lhs = static_cast<_Rhs&&>(__rhs) } -> same_as<_Lhs>;
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
from libpqxx.
Does #772 solve the probem?
from libpqxx.
The following code
pqxx::connection conn;
pqxx::work tx{conn};
std::ranges::input_range auto s = tx.stream<int>("SELECT generate_series(1, 10)");
auto res = s | std::views::transform([](std::tuple<int> n) { return std::get<0>(n) * 2; });
fmt::print(">>> {}\n", res);
compiles in C++20 mode and gives the right result:
>>> [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
So #772 solves the problem.
Thank you!
from libpqxx.
Nice. The post-increment operator is not something you'd actually want to use, but why would one? I'm not sure why it's even in all these concepts.
from libpqxx.
Related Issues (20)
- Bind results of selects directly to a variable of type std::vector for array types HOT 9
- Efficient UUIDs HOT 3
- How to pass custom class to postgres function HOT 65
- PQXX_VERSION says '7.9.0' but I used tag 7.8.1 HOT 1
- User code won't compile with C++20 or C++23 HOT 4
- `splitconfig` should be `splitconfig.py`
- Is there a better way of doing this ? HOT 3
- Transaction declaration error HOT 10
- This doesn't compile on Linux HOT 9
- Array types with other containers HOT 4
- Iterator performance HOT 12
- Stream fails parsing empty `varchar`/`text` fields HOT 4
- Update source question HOT 6
- vcpkg libpqxx crashes upon connection destruction HOT 16
- Is calling to exec_prepared() considered as blocking operation ? HOT 2
- Not an issue but a favour request HOT 1
- Is it possible to build libpqxx without SSL support HOT 2
- CMakeLists.txt update c++ standard to 20 HOT 4
- Usage with meson? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libpqxx.