FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpp11/man/cpp_source.Rd at master · tmastny/cpp11 · GitHub
tmastny
/
cpp11
Public
forked from
r-lib/cpp11
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cpp11
/
man
/
cpp_source.Rd
Copy path
More file actions
More file actions
Latest commit
History
History
History
55 lines (47 loc) · 1.5 KB
Breadcrumbs
cpp11
/
man
/
cpp_source.Rd
Copy path
File metadata and controls
55 lines (47 loc) · 1.5 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
%
Generated
by
roxygen2
:
do
not
edit
by
hand
%
Please
edit
documentation
in
R
/
source.R
\
name
{
cpp_source
}
\
alias
{
cpp_source
}
\
alias
{
cpp_function
}
\
alias
{
cpp_eval
}
\
title
{
Compile
C
++
code
}
\
usage
{
cpp_source(
file
,
code
=
NULL
,
env
=
parent.frame(),
clean
=
TRUE
,
quiet
=
TRUE
)
cpp_function(
code
,
env
=
parent.frame(),
clean
=
TRUE
,
quiet
=
TRUE
)
cpp_eval(
code
,
env
=
parent.frame(),
clean
=
TRUE
,
quiet
=
TRUE
)
}
\
arguments
{
\
item
{
file
}{
A
file
containing
C
++
code
to
compile
}
\
item
{
code
}{
If
non
-
null
,
the
C
++
code
to
compile
}
\
item
{
env
}{
The
R
environment
where
the
R
wrapping
functions
should
be
defined.
}
\
item
{
clean
}{
If
\
code
{
TRUE
},
cleanup
the
files
after
sourcing
}
\
item
{
quiet
}{
If
'
TRUE`, do not show compiler output}
}
\v
alue{
For
\c
ode{
\l
ink[=cpp_source]{cpp_source()}} and
\v
erb{[cpp_function()]} the results of
\c
ode{
\l
ink[=dyn.load]{dyn.load()}} (invisibly). For
\v
erb{[cpp_eval()]} the results of the evaluated
expression.
}
\d
escription{
\c
ode{
\l
ink[=cpp_source]{cpp_source()}} compiles and loads a single C++ file for use in R.
\c
ode{
\l
ink[=cpp_function]{cpp_function()}} compiles and loads a single function for use in R.
\c
ode{
\l
ink[=cpp_eval]{cpp_eval()}} evaluates a single C++ expression and returns the result.
}
\e
xamples{
\d
ontrun{
cpp_source(
code =
'
#
include "cpp11/integers.hpp"
[[
cpp11
::
register
]]
int
num_odd(
cpp11
::
integers
x
) {
int
total
=
0
;
for
(
int
val
:
x
) {
if
((
val
\%
2
)
==
1
) {
++
total
;
}
}
return
total
;
}
'
)
num_odd(as.integer(c(1:10, 15, 23)))
}
}
Back
|
FazBrowse Home
|
New Git URL