Skip to content

Commit

Permalink
progress
Browse files Browse the repository at this point in the history
  • Loading branch information
ASDAlexander77 committed May 26, 2020
1 parent f2b775f commit e669190
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
19 changes: 5 additions & 14 deletions cpplib/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ concept BoolOrBoolean = (std::is_same_v<T, bool> || std::is_same_v<T, boolean>);
template<typename T>
concept can_cast_to_size_t = requires(T t) { static_cast<size_t>(t); };

template<typename T>
concept has_exists_member = requires { T::exists; };

template <class _Ty>
struct is_stringish :
std::bool_constant<std::is_same_v<_Ty, const char_t *>
Expand Down Expand Up @@ -3849,25 +3852,13 @@ object assign(object &dst, const Args &... args)

}; // namespace Utils

template <typename V>
constexpr bool in(V v, const array_any &a)
{
return a.exists(v);
}

template <typename V>
constexpr bool in(V v, const object &a)
{
return a.exists(v);
}

template <typename V, class Ax, class = std::enable_if_t<std::is_member_function_pointer_v<decltype(&Ax::exists)>>>
template <typename V, class Ax = void> requires has_exists_member<Ax>
constexpr bool in(V v, const Ax &a)
{
return a.exists(v);
}

template <typename V, class Ax, class = std::enable_if_t<std::is_member_function_pointer_v<decltype(&Ax::exists)>>>
template <typename V, class Ax = void> requires has_exists_member<Ax>
constexpr bool in(V v, Ax *a)
{
return a->exists(v);
Expand Down
10 changes: 3 additions & 7 deletions test/test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
class Matrix {
public m = [];
}

var result = new Matrix();
result.m[0] = 10;
console.log(result.m[0]);
let c = [1, 2, 3];
let b = 2 in c;
console.log(b);

0 comments on commit e669190

Please sign in to comment.