本文整理汇总了C#中ClassTemplate类的典型用法代码示例。如果您正苦于以下问题:C# ClassTemplate类的具体用法?C# ClassTemplate怎么用?C# ClassTemplate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClassTemplate类属于命名空间,在下文中一共展示了ClassTemplate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitClassTemplateDecl
public override bool VisitClassTemplateDecl(ClassTemplate template)
{
if (!base.VisitClassTemplateDecl(template))
return false;
template.Specializations.RemoveAll(
s => s.Fields.Any(f => f.Type.IsPrimitiveType(PrimitiveType.Void)));
if (template.Specializations.Count == 0)
return false;
var groups = (from specialization in template.Specializations
group specialization by specialization.Arguments.All(
a => a.Type.Type != null && a.Type.Type.IsAddress()) into @group
select @group).ToList();
var lastGroup = groups.Last();
if (lastGroup.Key)
{
foreach (var specialization in lastGroup.Skip(1))
template.Specializations.Remove(specialization);
}
return true;
}
示例2: VisitClassTemplateDecl
public override bool VisitClassTemplateDecl(ClassTemplate template)
{
if (!base.VisitClassTemplateDecl(template) || template.IsIncomplete)
return false;
template.Specializations.RemoveAll(
s => s.Fields.Any(f => f.Type.IsPrimitiveType(PrimitiveType.Void)));
if (template.Specializations.Count == 0)
return false;
var groups = (from specialization in template.Specializations
group specialization by specialization.Arguments.All(
a => a.Type.Type != null && a.Type.Type.IsAddress()) into @group
select @group).ToList();
foreach (var group in groups.Where(g => g.Key))
foreach (var specialization in group.Skip(1))
template.Specializations.Remove(specialization);
for (int i = template.Specializations.Count - 1; i >= 0; i--)
if (template.Specializations[i] is ClassTemplatePartialSpecialization)
template.Specializations.RemoveAt(i);
return true;
}
示例3: VisitClassTemplateDecl
public override bool VisitClassTemplateDecl(ClassTemplate template)
{
if (!base.VisitClassTemplateDecl(template))
return false;
// templates are not supported yet
foreach (var specialization in template.Specializations)
specialization.ExplicitlyIgnore();
return true;
}
示例4: VisitClassTemplateDecl
public override bool VisitClassTemplateDecl(ClassTemplate template)
{
if (!base.VisitClassTemplateDecl(template))
return false;
EnsureCompleteDeclaration(template.TemplatedDecl);
template.TemplatedDecl = template.TemplatedDecl.CompleteDeclaration ?? template.TemplatedDecl;
return true;
}
示例5: VisitClassTemplateDecl
public override bool VisitClassTemplateDecl(ClassTemplate template)
{
if (!base.VisitClassTemplateDecl(template))
return false;
if (!Driver.Options.IsCLIGenerator && template.IsSupportedStdType())
return false;
// templates are not supported yet
foreach (var specialization in template.Specializations)
specialization.ExplicitlyIgnore();
return true;
}
示例6: VisitClassTemplateDecl
public override bool VisitClassTemplateDecl(ClassTemplate template)
{
if (!base.VisitClassTemplateDecl(template))
return false;
EnsureCompleteDeclaration(template.TemplatedDecl);
template.TemplatedDecl = template.TemplatedDecl.CompleteDeclaration ?? template.TemplatedDecl;
// store all spesializations in the real template class because ClassTemplateDecl only forwards
foreach (var specialization in template.Specializations.Where(
s => !s.IsIncomplete && !template.TemplatedClass.Specializations.Contains(s)))
template.TemplatedClass.Specializations.Add(specialization);
return true;
}
示例7: VisitClassTemplateDecl
public override bool VisitClassTemplateDecl(ClassTemplate template)
{
if (!base.VisitClassTemplateDecl(template) ||
template.Specializations.Count == 0 ||
template.Specializations.All(s => s is ClassTemplatePartialSpecialization))
return false;
var @class = template.TemplatedDecl.Namespace as Class;
if (@class == null || @class is ClassTemplateSpecialization ||
@class.Namespace is Class)
return false;
if (movedClassTemplates.ContainsKey(@class.Namespace))
movedClassTemplates[@class.Namespace].Add(template);
else
movedClassTemplates.Add(@class.Namespace, new List<ClassTemplate> { template });
return true;
}
示例8: VisitClassTemplateDecl
public override bool VisitClassTemplateDecl(ClassTemplate template)
{
if (!base.VisitClassTemplateDecl(template))
return false;
if (template.IsIncomplete)
{
var completeDeclaration = (ClassTemplate) template.CompleteDeclaration;
foreach (var specialization in template.Specializations.Where(
spec => completeDeclaration.Specializations.All(s => s.USR != spec.USR)))
{
specialization.TemplatedDecl = completeDeclaration;
completeDeclaration.Specializations.Add(specialization);
}
}
EnsureCompleteDeclaration(template.TemplatedDecl);
template.TemplatedDecl = template.TemplatedDecl.CompleteDeclaration ?? template.TemplatedDecl;
return true;
}
示例9: VisitClassTemplateDecl
public override bool VisitClassTemplateDecl(ClassTemplate template)
{
var expansions = template.PreprocessedEntities.OfType<MacroExpansion>();
var expansion = expansions.FirstOrDefault(e => e.Text.StartsWith(Prefix + "_CONSTRAINT"));
if (expansion != null)
{
var args = GetArguments(expansion.Text);
for (var i = 0; i < template.Parameters.Count && i < args.Length; ++i)
{
var param = template.Parameters[i];
param.Constraint = args[i];
template.Parameters[i] = param;
}
}
return base.VisitClassTemplateDecl(template);
}
示例10: ClassTemplate
internal ClassTemplate(ClassTemplate.Internal native)
: this(&native)
{
}
示例11: ClassTemplate
private ClassTemplate(ClassTemplate.Internal native)
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
}
示例12: VisitClassTemplateDecl
public override bool VisitClassTemplateDecl(ClassTemplate template)
{
CheckForTemplateConstraints(template);
return base.VisitClassTemplateDecl(template);
}
示例13: ClassTemplate
private ClassTemplate(ClassTemplate.Internal native)
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
示例14: __CreateInstance
public static ClassTemplate __CreateInstance(ClassTemplate.Internal native)
{
return new ClassTemplate(native);
}
示例15: ClassTemplate
private ClassTemplate(ClassTemplate.Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}