[CXX-617] bsoncxx::builder::core::append of unsigned int? Created: 28/Jun/15 Updated: 11/Sep/19 Resolved: 28/Jun/15 |
|
| Status: | Closed |
| Project: | C++ Driver |
| Component/s: | BSON |
| Affects Version/s: | 0.2.0 |
| Fix Version/s: | None |
| Type: | Task | Priority: | Minor - P4 |
| Reporter: | hczhcz | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Linux Mint 17.2 RC amd64 |
||
| Description |
|
There are overloading versions of bsoncxx::builder::core::append that accepts native int32_t and int64_t. Example: Although we could use BSON value classes instead of native types, it needs more code if the type of value is a template argument. template <class T> Are there workarounds? |
| Comments |
| Comment by hczhcz [ 29/Jun/15 ] |
|
adam.midvidy, thanks! |
| Comment by Adam Midvidy [ 28/Jun/15 ] |
|
hczhcz, this is actually by design. If you look at the BSON specification (http://bsonspec.org/spec.html) the two integer types supported are a 32-bit signed integer and a 64-bit signed integer. It would be unsafe for us to provide an overload for unsigned integers as there would be the potential for overflow. I recommend instead that you static_cast your integral values to signed types before appending them to a document, if you can be sure that the values fit in the corresponding signed type. |