Fix bind const std::vector<boost::optional<>> with soci::use;#797
Fix bind const std::vector<boost::optional<>> with soci::use;#797Lokimed wants to merge 3 commits intoSOCI:masterfrom
Conversation
|
i will fix test. boost need test in common-tests.h |
d8a227b to
d7e418d
Compare
|
This isn't really specific to vectors of I'm not sure what's the purpose of |
|
Without my fix not compile exchange(soci::use()) with any const vector<boost::optional<>> |
|
problem is than for const vector<boost::optional> deduced user_type_tag instead basic_type_tag i think. |
|
I did It!!! Soon will be commit |
d7e418d to
950e9e1
Compare
vadz
left a comment
There was a problem hiding this comment.
Sorry I'm still not sure if this is the right thing to do... Any comments from the others would be very welcome.
tests/empty/test-empty.cpp
Outdated
| sql << query, use(i, ind); | ||
|
|
||
| std::vector<int> numbers(100); | ||
| const std::vector<int>& cref_numbers = numbers; |
There was a problem hiding this comment.
I'm not sure if this really belongs here, wouldn't it be better to add this to the real tests, i.e. to common-tests.h?
There was a problem hiding this comment.
This test not run every time? Why better move to common-tests.h?
If you insist, i will fix.
tests/common-tests.h
Outdated
|
|
||
| // test us bind with const vector<boost::optional> | ||
| { | ||
| const std::string query = "insert"; |
There was a problem hiding this comment.
This is a bit weird, what do the duplicated statements using this string instead of the literal constant supposed to check?
There was a problem hiding this comment.
I took so test from "soci/tests/empty/test-empty.cpp". I mean about duplicated statements.
I think aim is check char* and std::sting with operator << work correct and after possible bind values.
My aim is only check bind with vector<boost> with supported type and CONST vector<boost> with supported type.
If you want i can delete part of checks?
include/soci/exchange-traits.h
Outdated
| #ifdef SOCI_HAVE_BOOST | ||
| template <typename T> | ||
| struct exchange_traits<boost::optional<T> > | ||
| { | ||
| typedef typename exchange_traits<T>::type_family type_family; | ||
| enum { x_type = exchange_traits<T>::x_type }; | ||
| }; | ||
| #endif | ||
|
|
There was a problem hiding this comment.
Could this be done in include/soci/boost-optional.h? It seems like a more appropriate place for it.
b06b1dd to
4c07118
Compare
4c07118 to
d0afed1
Compare
|
I watched on class
and also used const_cast |
fea10ae to
7b6c954
Compare
|
Let's wath to class conversion_use_type
class Let's watch to
Have have no method - convert_from_base Let's watch to Have have no method - convert_from_base but have method virtual void convert_to_base() {} So if possible usw modern C++ and use override in all pace wheen possible, i think we must get compilation error for class conversion_use_type<std::vector |
7b6c954 to
3a54d5d
Compare
|
Is there any problems which i need fix or explain? |
|
Sorry, no, I just didn't have time to address this yet, I don't think we still need changes in |
Okay i will delete changes in |
8c1d415 to
bbd4c73
Compare
|
Thanks, this really looks like the right thing to do to me, so even though I still don't fully understand what's going on here (and notably why were all these Thanks again! |
No description provided.