Rcpp Version 1.0.14
Loading...
Searching...
No Matches
ChildVector.h
Go to the documentation of this file.
1// ChildVector.h: Rcpp R/C++ interface class library -- vector children of lists
2//
3// Copyright (C) 2014 Dirk Eddelbuettel, Romain Francois and Kevin Ushey
4//
5// This file is part of Rcpp.
6//
7// Rcpp is free software: you can redistribute it and/or modify it
8// under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 2 of the License, or
10// (at your option) any later version.
11//
12// Rcpp is distributed in the hope that it will be useful, but
13// WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
19
20#ifndef Rcpp__Vector__ChildVector__h
21#define Rcpp__Vector__ChildVector__h
22
23namespace Rcpp {
24
25template <typename T>
26class ChildVector : public T {
27
28 public:
29
31 T(data_),
33 i(i_) {}
34
39
41 if (this != &other) {
42 this->set__(other);
43 if (parent != NULL && !Rf_isNull(parent)) {
45 }
46 }
47 return *this;
48 }
49
50 inline ChildVector& operator=(const T& other) {
51 this->set__(other);
52 if (parent != NULL && !Rf_isNull(parent)) {
54 }
55 return *this;
56 }
57
58 template <typename U>
59 inline ChildVector& operator=(const U& other) {
61 T vec = as<T>(wrapped);
62 this->set__(vec);
63 if (parent != NULL && !Rf_isNull(parent)) {
64 SET_VECTOR_ELT(parent, i, vec);
65 }
66 return *this;
67 }
68
69 private:
72};
73
74} // namespace Rcpp
75
76#endif
77
ChildVector & operator=(const U &other)
Definition ChildVector.h:59
ChildVector & operator=(const T &other)
Definition ChildVector.h:50
ChildVector & operator=(const ChildVector &other)
Definition ChildVector.h:40
ChildVector(const ChildVector &other)
Definition ChildVector.h:35
ChildVector(SEXP data_, SEXP parent_, R_xlen_t i_)
Definition ChildVector.h:30
Rcpp API.
Definition algo.h:28
T as(SEXP x)
Definition as.h:151
SEXP wrap(const Date &date)
Definition Date.h:38