| 36 | RCPP_GENERATE_CTOR_ASSIGN(Function_Impl) |
| 37 | |
| 38 | Function_Impl(SEXP x){ |
| 39 | switch( TYPEOF(x) ){ |
| 40 | case CLOSXP: |
| 41 | case SPECIALSXP: |
| 42 | case BUILTINSXP: |
| 43 | Storage::set__(x); |
| 44 | break; |
| 45 | default: // #nocov start |
| 46 | const char* fmt = "Cannot convert object to a function: " |
| 47 | "[type=%s; target=CLOSXP, SPECIALSXP, or " |
| 48 | "BUILTINSXP]."; |
| 49 | throw not_compatible(fmt, Rf_type2char(TYPEOF(x))); |
| 50 | } // #nocov end |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Finds a function. By default, searches from the global environment |