Skip to content

Commit 8ebc7e8

Browse files
committed
Mark implicit conversion operators as deprecated and add NEWS bullet
1 parent ab48d33 commit 8ebc7e8

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# cpp11 (development version)
22

3+
* Implicit conversion from `sexp` to `bool`, `size_t`, and `double` has been
4+
marked as deprecated and will be removed in the next version of cpp11. The 3
5+
packages that were using this have been notified and sent PRs. The recommended
6+
approach is to instead use `cpp11::as_cpp<T>`, which performs type and length
7+
checking, making it much safer to use.
8+
39
* New `writable::data_frame` constructor that also takes the number of rows as
410
input. This accounts for the edge case where the input list has 0 columns but
511
you'd still like to specify a known number of rows (#272).

inst/include/cpp11/sexp.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,14 @@ class sexp {
6565
}
6666

6767
operator SEXP() const { return data_; }
68+
SEXP data() const { return data_; }
69+
70+
/// DEPRECATED: Do not use this, it will be removed soon.
6871
operator double() const { return REAL_ELT(data_, 0); }
72+
/// DEPRECATED: Do not use this, it will be removed soon.
6973
operator size_t() const { return REAL_ELT(data_, 0); }
74+
/// DEPRECATED: Do not use this, it will be removed soon.
7075
operator bool() const { return LOGICAL_ELT(data_, 0); }
71-
SEXP data() const { return data_; }
7276
};
7377

7478
} // namespace cpp11

0 commit comments

Comments
 (0)