-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
qinwf
committed
Mar 13, 2020
1 parent
d511fbf
commit 54b6a7c
Showing
46 changed files
with
6,892 additions
and
10,575 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Package: re2r | ||
Type: Package | ||
Title: RE2 Regular Expression | ||
Version: 0.2.0 | ||
Version: 0.3.0 | ||
Authors@R: c( | ||
person("Qin Wenfeng", email = "[email protected]", role = c("aut", "cre")), | ||
person("Toby Dylan Hocking", role = "ctb", comment = "benchmarks"), | ||
|
@@ -17,7 +17,7 @@ Authors@R: c( | |
) | ||
Maintainer: Qin Wenfeng <[email protected]> | ||
Description: RE2 <https://github.com/google/re2> is a primarily deterministic finite automaton based regular expression engine from Google that is very fast | ||
at matching large amounts of text. | ||
at matching large amounts of text. | ||
License: BSD_3_clause + file LICENSE | ||
LazyData: TRUE | ||
Depends: R (>= 3.3) | ||
|
@@ -33,5 +33,6 @@ URL: https://github.com/qinwf/re2r/ | |
BugReports: https://github.com/qinwf/re2r/issues | ||
VignetteBuilder: knitr | ||
NeedsCompilation: yes | ||
RoxygenNote: 6.0.1 | ||
RoxygenNote: 6.1.1 | ||
SystemRequirements: GNU make | ||
Encoding: UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright 2018 The RE2 Authors. All Rights Reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
#ifndef RE2_POD_ARRAY_H_ | ||
#define RE2_POD_ARRAY_H_ | ||
|
||
#include <memory> | ||
#include <type_traits> | ||
|
||
namespace re2 { | ||
|
||
template <typename T> | ||
class PODArray { | ||
public: | ||
static_assert(std::is_trivial<T>::value && std::is_standard_layout<T>::value, | ||
"T must be POD"); | ||
|
||
PODArray() | ||
: ptr_() {} | ||
explicit PODArray(int len) | ||
: ptr_(std::allocator<T>().allocate(len), Deleter(len)) {} | ||
|
||
T* data() const { | ||
return ptr_.get(); | ||
} | ||
|
||
int size() const { | ||
return ptr_.get_deleter().len_; | ||
} | ||
|
||
T& operator[](int pos) const { | ||
return ptr_[pos]; | ||
} | ||
|
||
private: | ||
struct Deleter { | ||
Deleter() | ||
: len_(0) {} | ||
explicit Deleter(int len) | ||
: len_(len) {} | ||
|
||
void operator()(T* ptr) const { | ||
std::allocator<T>().deallocate(ptr, len_); | ||
} | ||
|
||
int len_; | ||
}; | ||
|
||
std::unique_ptr<T[], Deleter> ptr_; | ||
}; | ||
|
||
} // namespace re2 | ||
|
||
#endif // RE2_POD_ARRAY_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.