diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-03-09 23:30:14 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-03-09 23:30:14 -0500 |
commit | 41decb9a671e4d0fbbe12533372435ec6ede2246 (patch) | |
tree | 35cd3c7bc9ba623a62aefc7492ed6a5fd157e40d /verbly/c++14.h | |
parent | 4d8fd1c470c5f2c190f082683321b40a566cf1c9 (diff) | |
download | furries-41decb9a671e4d0fbbe12533372435ec6ede2246.tar.gz furries-41decb9a671e4d0fbbe12533372435ec6ede2246.tar.bz2 furries-41decb9a671e4d0fbbe12533372435ec6ede2246.zip |
Started verbly rewrite
verbly is intended to be a general use natural language generation library. Here, I'm using it to simply generate random verbs or adjectives. A schema for the sqlite database is provided, and for testing I manually added data. A generator program is being written that will generate a database from WordNet, VerbNet, PropBank, and AGID data.
Diffstat (limited to 'verbly/c++14.h')
-rw-r--r-- | verbly/c++14.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/verbly/c++14.h b/verbly/c++14.h new file mode 100644 index 0000000..b3efbe2 --- /dev/null +++ b/verbly/c++14.h | |||
@@ -0,0 +1,35 @@ | |||
1 | #include <cstddef> | ||
2 | #include <memory> | ||
3 | #include <type_traits> | ||
4 | #include <utility> | ||
5 | |||
6 | namespace std { | ||
7 | template<class T> struct _Unique_if { | ||
8 | typedef unique_ptr<T> _Single_object; | ||
9 | }; | ||
10 | |||
11 | template<class T> struct _Unique_if<T[]> { | ||
12 | typedef unique_ptr<T[]> _Unknown_bound; | ||
13 | }; | ||
14 | |||
15 | template<class T, size_t N> struct _Unique_if<T[N]> { | ||
16 | typedef void _Known_bound; | ||
17 | }; | ||
18 | |||
19 | template<class T, class... Args> | ||
20 | typename _Unique_if<T>::_Single_object | ||
21 | make_unique(Args&&... args) { | ||
22 | return unique_ptr<T>(new T(std::forward<Args>(args)...)); | ||
23 | } | ||
24 | |||
25 | template<class T> | ||
26 | typename _Unique_if<T>::_Unknown_bound | ||
27 | make_unique(size_t n) { | ||
28 | typedef typename remove_extent<T>::type U; | ||
29 | return unique_ptr<T>(new U[n]()); | ||
30 | } | ||
31 | |||
32 | template<class T, class... Args> | ||
33 | typename _Unique_if<T>::_Known_bound | ||
34 | make_unique(Args&&...) = delete; | ||
35 | } | ||