Skip to content

Commit

Permalink
Remove extra boost (#86)
Browse files Browse the repository at this point in the history
* Add own make_unique implementation
* Remove usage of boost.multiprecission
  • Loading branch information
rstub authored Apr 29, 2024
1 parent c5c07e5 commit f2bf55d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/revdepcheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
"revdep",
repos = "https://cloud.r-project.org/")
tools::check_packages_in_dir("revdep",
check_args = "--as-cran --no-manual",
check_args = "--no-manual",
Ncpus = 4)
tools::summarize_check_packages_in_dir_results("revdep")
Expand Down
12 changes: 7 additions & 5 deletions inst/include/dqrng_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@
#include <dqrng_types.h>
#include <xoshiro.h>
#include <pcg_random.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <Rcpp.h>
#include <convert_seed.h>
#include <R_randgen.h>

#if defined(__cpp_lib_make_unique) && (__cpp_lib_make_unique >= 201304)
using std::make_unique;
#else
#include <boost/smart_ptr/make_unique.hpp>
using boost::make_unique;
template<typename T, typename... Args>
std::unique_ptr<T> make_unique(Args&&... args) {
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
#endif

namespace dqrng {
Expand Down Expand Up @@ -102,10 +103,11 @@ inline void random_64bit_wrapper<::dqrng::xoshiro256starstar>::set_stream(result
template<>
inline void random_64bit_wrapper<pcg64>::set_stream(result_type stream) {
// set the stream relative to the current stream, i.e. stream = 0 does not change the RNG
boost::multiprecision::uint128_t number;
std::vector<boost::multiprecision::uint128_t> state;
pcg_extras::pcg128_t number;
std::vector<pcg_extras::pcg128_t> state;
std::stringstream iss;
iss << gen;
using pcg_extras::operator>>;
while (iss >> number)
state.push_back(number);
// state[1] is the current stream
Expand Down

0 comments on commit f2bf55d

Please sign in to comment.