Skip to content

Commit 91ae369

Browse files
committed
reformatted to four spaces, standard Emacs header line
1 parent 1f96d70 commit 91ae369

File tree

2 files changed

+75
-75
lines changed

2 files changed

+75
-75
lines changed

inst/include/Rcpp/InternalFunction.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
1+
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
22
//
33
// InternalFunction.h: Rcpp R/C++ interface class library -- exposing C++ functions
44
//
@@ -38,14 +38,14 @@ namespace Rcpp{
3838
RCPP_GENERATE_CTOR_ASSIGN(InternalFunction_Impl)
3939

4040
#ifdef RCPP_USING_CXX11
41-
template <typename RESULT_TYPE, typename... Args>
41+
template <typename RESULT_TYPE, typename... Args>
4242
InternalFunction_Impl(const std::function<RESULT_TYPE(Args...)> &fun) {
43-
set(
44-
XPtr<Rcpp::InternalFunctionWithStdFunction::CppFunctionBaseFromStdFunction<RESULT_TYPE, Args...> >(
45-
new Rcpp::InternalFunctionWithStdFunction::CppFunctionBaseFromStdFunction<RESULT_TYPE, Args...>(fun),
46-
false
47-
)
48-
);
43+
set(
44+
XPtr<Rcpp::InternalFunctionWithStdFunction::CppFunctionBaseFromStdFunction<RESULT_TYPE, Args...> >(
45+
new Rcpp::InternalFunctionWithStdFunction::CppFunctionBaseFromStdFunction<RESULT_TYPE, Args...>(fun),
46+
false
47+
)
48+
);
4949
}
5050
#endif
5151

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,67 @@
1-
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
2-
//
3-
// InternalFunction_with_std_function.h: Rcpp R/C++ interface class library -- exposing C++ std::function's
4-
//
5-
// Copyright (C) 2014 Christian Authmann
6-
// Copyright (C) 2015 Romain Francois
7-
//
8-
// This file is part of Rcpp.
9-
//
10-
// Rcpp is free software: you can redistribute it and/or modify it
11-
// under the terms of the GNU General Public License as published by
12-
// the Free Software Foundation, either version 2 of the License, or
13-
// (at your option) any later version.
14-
//
15-
// Rcpp is distributed in the hope that it will be useful, but
16-
// WITHOUT ANY WARRANTY; without even the implied warranty of
17-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18-
// GNU General Public License for more details.
19-
//
20-
// You should have received a copy of the GNU General Public License
21-
// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
22-
23-
#ifndef Rcpp_InternalFunctionWithStdFunction_h
24-
#define Rcpp_InternalFunctionWithStdFunction_h
25-
26-
#include <functional>
27-
28-
namespace Rcpp{
29-
30-
namespace InternalFunctionWithStdFunction {
31-
32-
#include <Rcpp/generated/InternalFunctionWithStdFunction_call.h>
33-
34-
template <typename RESULT_TYPE, typename... Args>
35-
class CppFunctionBaseFromStdFunction : public CppFunctionBase {
36-
public:
37-
CppFunctionBaseFromStdFunction(const std::function<RESULT_TYPE(Args...)> &fun) : fun(fun) {}
38-
virtual ~CppFunctionBaseFromStdFunction() {}
39-
40-
SEXP operator()(SEXP* args) {
41-
auto result = call<RESULT_TYPE, Args...>(fun, args);
42-
return Rcpp::module_wrap<RESULT_TYPE>(result);
43-
}
44-
45-
private:
46-
const std::function<RESULT_TYPE(Args...)> fun;
47-
};
48-
49-
template <typename... Args>
50-
class CppFunctionBaseFromStdFunction<void, Args...> : public CppFunctionBase {
51-
public:
52-
CppFunctionBaseFromStdFunction(const std::function<void(Args...)> &fun) : fun(fun) {}
53-
virtual ~CppFunctionBaseFromStdFunction() {}
54-
55-
SEXP operator()(SEXP* args) {
56-
call<void, Args...>(fun, args);
57-
return R_NilValue;
58-
}
59-
60-
private:
61-
const std::function<void(Args...)> fun;
62-
};
63-
64-
} // namespace InternalFunctionWithStdFunction
65-
} // namespace Rcpp
66-
67-
#endif
1+
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2+
//
3+
// InternalFunction_with_std_function.h: Rcpp R/C++ interface class library -- exposing C++ std::function's
4+
//
5+
// Copyright (C) 2014 Christian Authmann
6+
// Copyright (C) 2015 Romain Francois and Dirk Eddelbuettel
7+
//
8+
// This file is part of Rcpp.
9+
//
10+
// Rcpp is free software: you can redistribute it and/or modify it
11+
// under the terms of the GNU General Public License as published by
12+
// the Free Software Foundation, either version 2 of the License, or
13+
// (at your option) any later version.
14+
//
15+
// Rcpp is distributed in the hope that it will be useful, but
16+
// WITHOUT ANY WARRANTY; without even the implied warranty of
17+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
// GNU General Public License for more details.
19+
//
20+
// You should have received a copy of the GNU General Public License
21+
// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
22+
23+
#ifndef Rcpp_InternalFunctionWithStdFunction_h
24+
#define Rcpp_InternalFunctionWithStdFunction_h
25+
26+
#include <functional>
27+
28+
namespace Rcpp {
29+
30+
namespace InternalFunctionWithStdFunction {
31+
32+
#include <Rcpp/generated/InternalFunctionWithStdFunction_call.h>
33+
34+
template <typename RESULT_TYPE, typename... Args>
35+
class CppFunctionBaseFromStdFunction : public CppFunctionBase {
36+
public:
37+
CppFunctionBaseFromStdFunction(const std::function<RESULT_TYPE(Args...)> &fun) : fun(fun) {}
38+
virtual ~CppFunctionBaseFromStdFunction() {}
39+
40+
SEXP operator()(SEXP* args) {
41+
auto result = call<RESULT_TYPE, Args...>(fun, args);
42+
return Rcpp::module_wrap<RESULT_TYPE>(result);
43+
}
44+
45+
private:
46+
const std::function<RESULT_TYPE(Args...)> fun;
47+
};
48+
49+
template <typename... Args>
50+
class CppFunctionBaseFromStdFunction<void, Args...> : public CppFunctionBase {
51+
public:
52+
CppFunctionBaseFromStdFunction(const std::function<void(Args...)> &fun) : fun(fun) {}
53+
virtual ~CppFunctionBaseFromStdFunction() {}
54+
55+
SEXP operator()(SEXP* args) {
56+
call<void, Args...>(fun, args);
57+
return R_NilValue;
58+
}
59+
60+
private:
61+
const std::function<void(Args...)> fun;
62+
};
63+
64+
} // namespace InternalFunctionWithStdFunction
65+
} // namespace Rcpp
66+
67+
#endif

0 commit comments

Comments
 (0)