www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - newbie question

reply f <f abc.com> writes:


1. how to check template inheritance

interface I
class A : I { void run(){}}
class B : A {}

void D\<T> (T t) : where T:B, new T()
{
t.run();
}
d code
//there should be has several check such as hasBase, 
hasImplements on std.traits
void D(T) (int a) if (isBase(T,B))
{
}

2. how to make  built in array , std.container.slist, 
container.HashMap (emsi_containers)  a range


void a(IEnumerable\<string> a) {}

dcode
void a(InputRange!string a) {}

// notworking : i slice it to get Range
int[] i=[1,3,4];
a(i[0..2]);

3. known OAuth / OIDC Api Sdk in D.
there is only Jwt stuff when search code.dlang.org.

4. how to make proxy in D that can intercept call. java has one 
(or two perhaps)

thanks in advance.
Oct 31
next sibling parent Sergey <kornburn yandex.ru> writes:
On Thursday, 31 October 2024 at 09:10:32 UTC, f wrote:
 3. known OAuth / OIDC Api Sdk in D.
 there is only Jwt stuff when search code.dlang.org.
https://code.dlang.org/packages/oauth https://code.dlang.org/packages/vibe-auth
Oct 31
prev sibling parent Sergey <kornburn yandex.ru> writes:
On Thursday, 31 October 2024 at 09:10:32 UTC, f wrote:


 2. how to make  built in array , std.container.slist, 
 container.HashMap (emsi_containers)  a range


 void a(IEnumerable\<string> a) {}

 dcode
 void a(InputRange!string a) {}

 // notworking : i slice it to get Range
 int[] i=[1,3,4];
 a(i[0..2]);
```d void f (InputRange!int f) { writeln(f); } auto x = [1,2,3,4,5]; f(inputRangeObject(x[1..3])); ```
Oct 31