text:
using System;
using System.Runtime.InteropServices;
using System.Security;
using System.Runtime.CompilerServices;

[assembly:InternalsVisibleTo("CppSharp.Parser.CSharp")]

[assembly:InternalsVisibleTo("CppSharp.CppParser")]

namespace Std
{
    namespace Allocator
    {
        [StructLayout(LayoutKind.Explicit, Size = 0)]
        public unsafe partial struct __Internal
        {
            [SuppressUnmanagedCodeSecurity]
            [DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
                EntryPoint="_ZNSaIcEC2Ev")]
            internal static extern void ctorc__N_std_S_allocator__C(global::System.IntPtr instance);

            [SuppressUnmanagedCodeSecurity]
            [DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
                EntryPoint="_ZNSaIcED2Ev")]
            internal static extern void dtorc__N_std_S_allocator__C(global::System.IntPtr instance);
        }
    }

    public unsafe partial class Allocator<_Tp> : IDisposable
    {
        public global::System.IntPtr __Instance { get; protected set; }

        protected int __PointerAdjustment;
        internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::Std.Allocator<_Tp>> NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::Std.Allocator<_Tp>>();
        protected void*[] __OriginalVTables;

        protected bool __ownsNativeInstance;

        internal static global::Std.Allocator<_Tp> __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
        {
            return new global::Std.Allocator<_Tp>(native.ToPointer(), skipVTables);
        }

        internal static global::Std.Allocator<_Tp> __CreateInstance(global::Std.Allocator.__Internal native, bool skipVTables = false)
        {
            return new global::Std.Allocator<_Tp>(native, skipVTables);
        }

        private static void* __CopyValue(global::Std.Allocator.__Internal native)
        {
            var ret = Marshal.AllocHGlobal(sizeof(global::Std.Allocator.__Internal));
            *(global::Std.Allocator.__Internal*) ret = native;
            return ret.ToPointer();
        }

        private Allocator(global::Std.Allocator.__Internal native, bool skipVTables = false)
            : this(__CopyValue(native), skipVTables)
        {
            __ownsNativeInstance = true;
            NativeToManagedMap[__Instance] = this;
        }

        protected Allocator(void* native, bool skipVTables = false)
        {
            if (native == null)
                return;
            __Instance = new global::System.IntPtr(native);
        }

        public Allocator()
        {
            var ___Tp = typeof(_Tp);
            if (___Tp.IsAssignableFrom(typeof(sbyte)))
            {
                __Instance = Marshal.AllocHGlobal(sizeof(global::Std.Allocator.__Internal));
                __ownsNativeInstance = true;
                NativeToManagedMap[__Instance] = this;
                global::Std.Allocator.__Internal.ctorc__N_std_S_allocator__C((__Instance + __PointerAdjustment));
                return;
            }
            throw new ArgumentOutOfRangeException("_Tp", string.Join(", ", new[] { typeof(_Tp).FullName }), "global::Std.Allocator<_Tp> maps a C++ template class and therefore it only supports a limited set of types and their subclasses: <sbyte>.");
        }

        public void Dispose()
        {
            Dispose(disposing: true);
        }

        public virtual void Dispose(bool disposing)
        {
            if (__Instance == IntPtr.Zero)
                return;
            global::Std.Allocator<_Tp> __dummy;
            NativeToManagedMap.TryRemove(__Instance, out __dummy);
            if (disposing)
            {
                var ___Tp = typeof(_Tp);
                if (___Tp.IsAssignableFrom(typeof(sbyte)))
                {
                    global::Std.Allocator.__Internal.dtorc__N_std_S_allocator__C((__Instance + __PointerAdjustment));
                    return;
                }
                throw new ArgumentOutOfRangeException("_Tp", string.Join(", ", new[] { typeof(_Tp).FullName }), "global::Std.Allocator<_Tp> maps a C++ template class and therefore it only supports a limited set of types and their subclasses: <sbyte>.");
            }
            if (__ownsNativeInstance)
                Marshal.FreeHGlobal(__Instance);
            __Instance = IntPtr.Zero;
        }
    }
}

namespace Std
{
    namespace Vector
    {
        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_PreprocessedEntity___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_PreprocessedEntity___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_Declaration___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Declaration___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_BlockContentComment___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_BlockContentComment___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_Namespace___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Namespace___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_Enumeration___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Enumeration___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_Function___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Function___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_Class___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Class___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_Template___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Template___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_TypedefDecl___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_TypedefDecl___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_TypeAlias___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_TypeAlias___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_Variable___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Variable___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_Friend___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Friend___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_BaseClassSpecifier___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_BaseClassSpecifier___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_Field___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Field___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_Method___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Method___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_Parameter___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Parameter___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_FunctionTemplateSpecialization___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_FunctionTemplateSpecialization___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector____N_CppSharp_N_CppParser_N_AST_S_TemplateArgument___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_TemplateArgument___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_AccessSpecifierDecl___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_AccessSpecifierDecl___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector____N_CppSharp_N_CppParser_N_AST_S_VFTableInfo___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_VFTableInfo___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector____N_CppSharp_N_CppParser_N_AST_S_VTableComponent___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_VTableComponent___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector____N_CppSharp_N_CppParser_N_AST_S_LayoutField___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_LayoutField___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector____N_CppSharp_N_CppParser_N_AST_S_LayoutBase___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_LayoutBase___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_Enumeration_S_Item___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Enumeration_S_Item___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector____N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base____N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_ClassTemplateSpecialization___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_ClassTemplateSpecialization___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_Expression___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Expression___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_VarTemplateSpecialization___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_VarTemplateSpecialization___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_MacroDefinition___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_MacroDefinition___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_TranslationUnit___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_TranslationUnit___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_InlineContentComment___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_InlineContentComment___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector____N_CppSharp_N_CppParser_N_AST_S_BlockCommandComment_S_Argument___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_BlockCommandComment_S_Argument___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector__i___N_std_S_allocator__i
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base__i___N_std_S_allocator__i _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_VerbatimBlockLineComment___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_VerbatimBlockLineComment___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector____N_CppSharp_N_CppParser_N_AST_S_InlineCommandComment_S_Argument___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_InlineCommandComment_S_Argument___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector____N_CppSharp_N_CppParser_N_AST_S_HTMLStartTagComment_S_Attribute___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_HTMLStartTagComment_S_Attribute___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S_vector____N_CppSharp_N_CppParser_S_ParserDiagnostic___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_S_ParserDiagnostic___N_std_S_allocator__S0_ _M_impl;
        }
    }

    namespace VectorBase
    {
        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_PreprocessedEntity___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_PreprocessedEntity___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Declaration___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Declaration___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_BlockContentComment___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_BlockContentComment___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Template___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Template___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_TypedefDecl___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_TypedefDecl___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_TypeAlias___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_TypeAlias___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Variable___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Variable___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Friend___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Friend___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_BaseClassSpecifier___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_BaseClassSpecifier___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Field___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Field___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Parameter___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Parameter___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_FunctionTemplateSpecialization___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_FunctionTemplateSpecialization___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_TemplateArgument___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_TemplateArgument___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Method___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Method___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_AccessSpecifierDecl___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_AccessSpecifierDecl___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_VTableComponent___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_VTableComponent___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_VFTableInfo___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_VFTableInfo___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_LayoutField___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_LayoutField___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_LayoutBase___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_LayoutBase___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Class___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Class___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Function___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Function___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Enumeration_S_Item___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Enumeration_S_Item___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Enumeration___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Enumeration___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Namespace___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Namespace___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base____N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base____N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_ClassTemplateSpecialization___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_ClassTemplateSpecialization___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Expression___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Expression___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_VarTemplateSpecialization___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_VarTemplateSpecialization___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_MacroDefinition___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_MacroDefinition___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_TranslationUnit___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_TranslationUnit___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_InlineContentComment___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_InlineContentComment___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_BlockCommandComment_S_Argument___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_BlockCommandComment_S_Argument___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base__i___N_std_S_allocator__i
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base__i___N_std_S_allocator__i _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_VerbatimBlockLineComment___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_VerbatimBlockLineComment___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_InlineCommandComment_S_Argument___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_InlineCommandComment_S_Argument___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_HTMLStartTagComment_S_Attribute___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_HTMLStartTagComment_S_Attribute___N_std_S_allocator__S0_ _M_impl;
        }

        [StructLayout(LayoutKind.Explicit, Size = 24)]
        public unsafe partial struct __Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_S_ParserDiagnostic___N_std_S_allocator__S0_
        {
            [FieldOffset(0)]
            internal global::Std.VectorBase.VectorImpl.__Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_S_ParserDiagnostic___N_std_S_allocator__S0_ _M_impl;
        }

        namespace VectorImpl
        {
            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_PreprocessedEntity___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Declaration___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_BlockContentComment___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Template___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_TypedefDecl___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_TypeAlias___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Variable___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Friend___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_BaseClassSpecifier___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Field___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Parameter___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_FunctionTemplateSpecialization___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_TemplateArgument___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Method___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_AccessSpecifierDecl___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_VTableComponent___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_VFTableInfo___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_LayoutField___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_LayoutBase___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Class___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Function___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Enumeration_S_Item___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Enumeration___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Namespace___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base____N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_ClassTemplateSpecialization___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_Expression___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_VarTemplateSpecialization___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_MacroDefinition___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_TranslationUnit___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_InlineContentComment___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_BlockCommandComment_S_Argument___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base__i___N_std_S_allocator__i
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base_____N_CppSharp_N_CppParser_N_AST_S_VerbatimBlockLineComment___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_InlineCommandComment_S_Argument___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_N_AST_S_HTMLStartTagComment_S_Attribute___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }

            [StructLayout(LayoutKind.Explicit, Size = 24)]
            public unsafe partial struct __Internalc__N_std_S__Vector_base____N_CppSharp_N_CppParser_S_ParserDiagnostic___N_std_S_allocator__S0_
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_start;

                [FieldOffset(8)]
                internal global::System.IntPtr _M_finish;

                [FieldOffset(16)]
                internal global::System.IntPtr _M_end_of_storage;
            }
        }

    }
}

namespace Std
{
    namespace Less
    {
        [StructLayout(LayoutKind.Explicit, Size = 0)]
        public unsafe partial struct __Internal
        {
        }
    }
}

namespace Std
{
    public enum RbTreeColor : uint
    {
        S_red = 0,
        S_black = 1
    }

    namespace RbTree
    {
        namespace RbTreeImpl
        {
            [StructLayout(LayoutKind.Explicit, Size = 48)]
            public unsafe partial struct __Internal
            {
                [FieldOffset(0)]
                internal global::Std.Less.__Internal _M_key_compare;

                [FieldOffset(8)]
                internal global::Std.RbTreeNodeBase.__Internal _M_header;

                [FieldOffset(40)]
                internal ulong _M_node_count;
            }
        }

        [StructLayout(LayoutKind.Explicit, Size = 48)]
        public unsafe partial struct __Internalc__N_std_S__Rb_tree____N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C___N_std_S_pair__1S0_____N_CppSharp_N_CppParser_N_AST_S_Declaration___N_std_S__Select1st__S3____N_std_S_less__S0____N_std_S_allocator__S3_
        {
            [FieldOffset(0)]
            internal global::Std.RbTree.RbTreeImpl.__Internal _M_impl;
        }
    }

    public unsafe partial class RbTreeNodeBase
    {
        [StructLayout(LayoutKind.Explicit, Size = 32)]
        public partial struct __Internal
        {
            [FieldOffset(0)]
            internal global::Std.RbTreeColor _M_color;

            [FieldOffset(8)]
            internal global::System.IntPtr _M_parent;

            [FieldOffset(16)]
            internal global::System.IntPtr _M_left;

            [FieldOffset(24)]
            internal global::System.IntPtr _M_right;
        }
    }
}

namespace GnuCxx
{
}

namespace Std
{
    namespace Map
    {
        [StructLayout(LayoutKind.Explicit, Size = 48)]
        public unsafe partial struct __Internalc__N_std_S_map____N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C____N_CppSharp_N_CppParser_N_AST_S_Declaration___N_std_S_less__S0____N_std_S_allocator____N_std_S_pair__1S0__S3_
        {
            [FieldOffset(0)]
            internal global::Std.RbTree.__Internalc__N_std_S__Rb_tree____N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C___N_std_S_pair__1S0_____N_CppSharp_N_CppParser_N_AST_S_Declaration___N_std_S__Select1st__S3____N_std_S_less__S0____N_std_S_allocator__S3_ _M_t;
        }
    }
}

namespace Std
{
}

namespace Std
{
    namespace CharTraits
    {
        [StructLayout(LayoutKind.Explicit, Size = 0)]
        public unsafe partial struct __Internal
        {
        }
    }

    public unsafe partial class CharTraits<_CharT> : IDisposable
    {
        public global::System.IntPtr __Instance { get; protected set; }

        protected int __PointerAdjustment;
        internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::Std.CharTraits<_CharT>> NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::Std.CharTraits<_CharT>>();
        protected void*[] __OriginalVTables;

        protected bool __ownsNativeInstance;

        internal static global::Std.CharTraits<_CharT> __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
        {
            return new global::Std.CharTraits<_CharT>(native.ToPointer(), skipVTables);
        }

        internal static global::Std.CharTraits<_CharT> __CreateInstance(global::Std.CharTraits.__Internal native, bool skipVTables = false)
        {
            return new global::Std.CharTraits<_CharT>(native, skipVTables);
        }

        private static void* __CopyValue(global::Std.CharTraits.__Internal native)
        {
            var ret = Marshal.AllocHGlobal(sizeof(global::Std.CharTraits.__Internal));
            *(global::Std.CharTraits.__Internal*) ret = native;
            return ret.ToPointer();
        }

        private CharTraits(global::Std.CharTraits.__Internal native, bool skipVTables = false)
            : this(__CopyValue(native), skipVTables)
        {
            __ownsNativeInstance = true;
            NativeToManagedMap[__Instance] = this;
        }

        protected CharTraits(void* native, bool skipVTables = false)
        {
            if (native == null)
                return;
            __Instance = new global::System.IntPtr(native);
        }

        public void Dispose()
        {
            Dispose(disposing: true);
        }

        public virtual void Dispose(bool disposing)
        {
            if (__Instance == IntPtr.Zero)
                return;
            global::Std.CharTraits<_CharT> __dummy;
            NativeToManagedMap.TryRemove(__Instance, out __dummy);
            if (__ownsNativeInstance)
                Marshal.FreeHGlobal(__Instance);
            __Instance = IntPtr.Zero;
        }
    }
}

namespace Std
{
    public unsafe static partial class BasicStringExtensions
    {
        [StructLayout(LayoutKind.Explicit, Size = 0)]
        public partial struct __Internal
        {
            [SuppressUnmanagedCodeSecurity]
            [DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
                EntryPoint="_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2EPKcRKS3_")]
            internal static extern global::System.IntPtr BasicString(global::System.IntPtr instance, [MarshalAs(UnmanagedType.LPStr)] string __s, global::System.IntPtr __a);

            [SuppressUnmanagedCodeSecurity]
            [DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
                EntryPoint="_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv")]
            internal static extern global::System.IntPtr CStr(global::System.IntPtr instance);
        }

        public static global::Std.BasicString<sbyte, global::Std.CharTraits<sbyte>, global::Std.Allocator<sbyte>> BasicString(string __s, global::Std.Allocator<sbyte> __a)
        {
            if (ReferenceEquals(__a, null))
                throw new global::System.ArgumentNullException("__a", "Cannot be null because it is a C++ reference (&).");
            var __arg1 = __a.__Instance;
            if (ReferenceEquals(__s, null))
                throw new global::System.ArgumentNullException(__s, "The underlying std::string cannot take null.");
            var __ret = Marshal.AllocHGlobal(32);
            __Internal.BasicString(__ret, __s, __arg1);
            global::Std.BasicString<sbyte, global::Std.CharTraits<sbyte>, global::Std.Allocator<sbyte>> __result0;
            if (__ret == IntPtr.Zero) __result0 = null;
            else if (global::Std.BasicString<sbyte, global::Std.CharTraits<sbyte>, global::Std.Allocator<sbyte>>.NativeToManagedMap.ContainsKey(__ret))
                __result0 = (global::Std.BasicString<sbyte, global::Std.CharTraits<sbyte>, global::Std.Allocator<sbyte>>) global::Std.BasicString<sbyte, global::Std.CharTraits<sbyte>, global::Std.Allocator<sbyte>>.NativeToManagedMap[__ret];
            else __result0 = global::Std.BasicString<sbyte, global::Std.CharTraits<sbyte>, global::Std.Allocator<sbyte>>.__CreateInstance(__ret);
            return __result0;
        }

        public static string CStr(this global::Std.BasicString<sbyte, global::Std.CharTraits<sbyte>, global::Std.Allocator<sbyte>> @this)
        {
            var __arg0 = ReferenceEquals(@this, null) ? global::System.IntPtr.Zero : @this.__Instance;
            var __ret = __Internal.CStr(__arg0);
            return Marshal.PtrToStringAnsi(__ret);
        }
    }

    namespace BasicString
    {
        [StructLayout(LayoutKind.Explicit, Size = 32)]
        public unsafe partial struct __Internalc__N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C
        {
            [FieldOffset(0)]
            internal global::Std.BasicString.AllocHider.__Internalc__N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C _M_dataplus;

            [FieldOffset(8)]
            internal ulong _M_string_length;

            [FieldOffset(16)]
            internal global::Std.BasicString._.__Internalc__N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C _;

            [SuppressUnmanagedCodeSecurity]
            [DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
                EntryPoint="_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev")]
            internal static extern void dtorc__N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C(global::System.IntPtr instance);

            [SuppressUnmanagedCodeSecurity]
            [DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
                EntryPoint="_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv")]
            internal static extern global::System.IntPtr CStrc__N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C(global::System.IntPtr instance);
        }

        namespace AllocHider
        {
            [StructLayout(LayoutKind.Explicit, Size = 8)]
            public unsafe partial struct __Internalc__N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C
            {
                [FieldOffset(0)]
                internal global::System.IntPtr _M_p;
            }

        }

        namespace _
        {
            [StructLayout(LayoutKind.Explicit, Size = 16)]
            public unsafe partial struct __Internalc__N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C
            {
                [FieldOffset(0)]
                internal fixed sbyte _M_local_buf[16];

                [FieldOffset(0)]
                internal ulong _M_allocated_capacity;
            }
        }

    }

    public unsafe partial class BasicString<_CharT, _Traits, _Alloc> : IDisposable
    {
        public global::System.IntPtr __Instance { get; protected set; }

        protected int __PointerAdjustment;
        internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::Std.BasicString<_CharT, _Traits, _Alloc>> NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::Std.BasicString<_CharT, _Traits, _Alloc>>();
        protected void*[] __OriginalVTables;

        protected bool __ownsNativeInstance;

        internal static global::Std.BasicString<_CharT, _Traits, _Alloc> __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
        {
            return new global::Std.BasicString<_CharT, _Traits, _Alloc>(native.ToPointer(), skipVTables);
        }

        internal static global::Std.BasicString<_CharT, _Traits, _Alloc> __CreateInstance(global::Std.BasicString.__Internalc__N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C native, bool skipVTables = false)
        {
            return new global::Std.BasicString<_CharT, _Traits, _Alloc>(native, skipVTables);
        }

        private static void* __CopyValue(global::Std.BasicString.__Internalc__N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C native)
        {
            var ret = Marshal.AllocHGlobal(sizeof(global::Std.BasicString.__Internalc__N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C));
            *(global::Std.BasicString.__Internalc__N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C*) ret = native;
            return ret.ToPointer();
        }

        private BasicString(global::Std.BasicString.__Internalc__N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C native, bool skipVTables = false)
            : this(__CopyValue(native), skipVTables)
        {
            __ownsNativeInstance = true;
            NativeToManagedMap[__Instance] = this;
        }

        protected BasicString(void* native, bool skipVTables = false)
        {
            if (native == null)
                return;
            __Instance = new global::System.IntPtr(native);
        }

        public void Dispose()
        {
            Dispose(disposing: true);
        }

        public virtual void Dispose(bool disposing)
        {
            if (__Instance == IntPtr.Zero)
                return;
            global::Std.BasicString<_CharT, _Traits, _Alloc> __dummy;
            NativeToManagedMap.TryRemove(__Instance, out __dummy);
            if (disposing)
            {
                var ___CharT = typeof(_CharT);
                var ___Traits = typeof(_Traits);
                var ___Alloc = typeof(_Alloc);
                if (___CharT.IsAssignableFrom(typeof(sbyte)) && ___Traits.IsAssignableFrom(typeof(global::Std.CharTraits<sbyte>)) && ___Alloc.IsAssignableFrom(typeof(global::Std.Allocator<sbyte>)))
                {
                    global::Std.BasicString.__Internalc__N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C.dtorc__N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C((__Instance + __PointerAdjustment));
                    return;
                }
                throw new ArgumentOutOfRangeException("_CharT, _Traits, _Alloc", string.Join(", ", new[] { typeof(_CharT).FullName, typeof(_Traits).FullName, typeof(_Alloc).FullName }), "global::Std.BasicString<_CharT, _Traits, _Alloc> maps a C++ template class and therefore it only supports a limited set of types and their subclasses: <sbyte, global::Std.CharTraits<sbyte>, global::Std.Allocator<sbyte>>.");
            }
            if (__ownsNativeInstance)
                Marshal.FreeHGlobal(__Instance);
            __Instance = IntPtr.Zero;
        }
    }
}

namespace Std
{
}


text:
<?php
namespace Lthrt\CCSBundle\Command;

use Lthrt\CCSBundle\DataFixtures\StatesLoader;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class LoadStatesCommand extends ContainerAwareCommand
{
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        $this
            ->setName('lthrt:load:states')
            ->setAliases(['lthrt:lo:st'])
            ->setDescription('Loads states into database, skipping states already present')
            ->addOption('overwrite', null, InputOption::VALUE_NONE, 'Overwrite even if abbreviation exists')
            ->addOption('em', null, InputOption::VALUE_REQUIRED, 'entity manager')
            ->setHelp(<<<EOT
The <info>lthrt:load:states</info> Loads states into a database if they are not already present.

EOT
            );
    }

    /**
     * {@inheritDoc}
     */
    protected function execute(
        InputInterface  $input,
        OutputInterface $output
    ) {
        $overwrite = $input->getOption('overwrite') ?: false;
        $emName    = $input->getOption('em');
        $manager   = $this->getContainer()->get('doctrine')->getManager($emName);
        $loader    = new StatesLoader($manager);
        $result    = $loader->loadStates($overwrite);
        if (isset($result['newStates']) && count($result['newStates'])) {
            $inserted = implode(', ', array_keys($result['newStates']));
            $output->writeln("<info>" . $inserted . "</info> added.");
            $output->writeln("");
        }
        if (isset($result['updatedStates']) && count($result['updatedStates'])) {
            $updated = implode(', ', array_keys($result['updatedStates']));
            $output->writeln("<info>" . $updated . "</info> updated.");
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
class QTClient
{
  public:

    static int
    execute(int argc, char *argv[], ServiceAPI* service_api);
};

#endif // QT_CLIENT_H


text:
package org.apache.eagle.service.alert.resolver;

/**
 * @since 6/16/15.
 */
public class AttributeResolveException extends Exception {
    public AttributeResolveException(String s, Exception e) {
        super(s, e);
    }

    public AttributeResolveException(Exception e) {
        super(e);
    }

    public AttributeResolveException(String s) {
        super(s);
    }
}


text:
//---------------------------------------------------------------------
// <copyright file="InputReferenceExpression.cs" company="Microsoft">
//      Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
// </copyright>
//---------------------------------------------------------------------

namespace Microsoft.OData.Client
{
    using System;
    using System.Diagnostics;
    using System.Linq.Expressions;

    /// <summary>
    /// Represents a reference to a bound resource set in the resource path.
    /// The type of the input reference is the element type of the set.
    /// </summary>
    /// <remarks>
    /// Because the type of the input reference is the element type of the set,
    /// it can be used to indicate what a range variable ranges over.
    ///
    /// For example, in input.Select(b => b.id), 'input' is an IQueryable of T,
    /// and 'b' is a parameter of type T. 'b' can be rebound as an input reference
    /// to 'input' by the InputBinder, which helps in query analysis and
    /// translation.
    /// </remarks>
    [DebuggerDisplay("InputReferenceExpression -> {Type}")]
    internal sealed class InputReferenceExpression : Expression
    {
        /// <summary>The resource or set referred to by this input reference expression</summary>
        private ResourceExpression target;

        /// <summary>
        /// Constructs a new input reference expression that refers to the specified resource set
        /// </summary>
        /// <param name="target">The target resource set that the new expression will reference</param>
        internal InputReferenceExpression(ResourceExpression target)
        {
            Debug.Assert(target != null, "Target resource set cannot be null");
            this.target = target;
        }

        /// <summary>
        /// The <see cref="Type"/> of the value represented by this <see cref="Expression"/>.
        /// </summary>
        public override Type Type
        {
            get { return this.target.ResourceType; }
        }

        /// <summary>
        /// The <see cref="ExpressionType"/> of the <see cref="Expression"/>.
        /// </summary>
        public override ExpressionType NodeType
        {
            get { return (ExpressionType)ResourceExpressionType.InputReference; }
        }

        /// <summary>
        /// Retrieves the resource set referred to by this input reference expression
        /// </summary>
        internal ResourceExpression Target
        {
            get { return this.target; }
        }

        /// <summary>
        /// Retargets this input reference to point to the resource set specified by <paramref name="newTarget"/>.
        /// </summary>
        /// <param name="newTarget">The <see cref="QueryableResourceExpression"/> that this input reference should use as its target</param>
        internal void OverrideTarget(QueryableResourceExpression newTarget)
        {
            Debug.Assert(newTarget != null, "Resource set cannot be null");
            Debug.Assert(newTarget.ResourceType.Equals(this.Type), "Cannot reference a resource set with a different resource type");

            this.target = newTarget;
        }
    }
}


text:
package main

import (
	"math/rand"
	"os"
	"path/filepath"
	"runtime"
	"time"

	"github.com/tangfeixiong/go-to-docker/cmd"
)

func main() {
	rand.Seed(time.Now().UTC().UnixNano())
	if len(os.Getenv("GOMAXPROCS")) == 0 {
		runtime.GOMAXPROCS(runtime.NumCPU())
	}

	basename := filepath.Base(os.Args[0])
	// command := cmd.CommandFor(basename)
	command := cmd.NewRootCommand(basename)
	if err := command.Execute(); err != nil {
		os.Exit(1)
	}
}


text:
videojs.addLanguage('sv', {
  "Play": "Spela",
  "Pause": "Pausa",
  "Current Time": "Aktuell tid",
  "Duration": "Total tid",
  "Remaining Time": "Återstående tid",
  "Stream Type": "Strömningstyp",
  "LIVE": "LIVE",
  "Loaded": "Laddad",
  "Progress": "Förlopp",
  "Fullscreen": "Fullskärm",
  "Non-Fullscreen": "Ej fullskärm",
  "Mute": "Ljud av",
  "Unmute": "Ljud på",
  "Playback Rate": "Uppspelningshastighet",
  "Subtitles": "Text på",
  "subtitles off": "Text av",
  "Captions": "Text på",
  "captions off": "Text av",
  "Chapters": "Kapitel",
  "You aborted the media playback": "Du har avbrutit videouppspelningen.",
  "A network error caused the media download to fail part-way.": "Ett nätverksfel gjorde att nedladdningen av videon avbröts.",
  "The media could not be loaded, either because the server or network failed or because the format is not supported.": "Det gick inte att ladda videon, antingen på grund av ett server- eller nätverksfel, eller för att formatet inte stöds.",
  "The media playback was aborted due to a corruption problem or because the media used features your browser did not support.": "Uppspelningen avbröts på grund av att videon är skadad, eller också för att videon använder funktioner som din webbläsare inte stöder.",
  "No compatible source was found for this media.": "Det gick inte att hitta någon kompatibel källa för den här videon."
});


text:
set -eo pipefail
OPA_EXEC="$1"
TARGET="$2"

opa() {
    local args="$*"
    echo "::group::$args"
    $OPA_EXEC $args
    echo "::endgroup::"
}

opa version
opa eval -t $TARGET 'time.now_ns()'
opa eval --format pretty --bundle test/cli/smoke/golden-bundle.tar.gz --input test/cli/smoke/input.json data.test.result --fail
opa exec --bundle test/cli/smoke/golden-bundle.tar.gz --decision test/result test/cli/smoke/input.json
opa build --output o0.tar.gz test/cli/smoke/test.rego
opa eval --format pretty --bundle o0.tar.gz --input test/cli/smoke/input.json data.test.result --fail
opa build --optimize 1 --output o1.tar.gz test/cli/smoke/test.rego
opa eval --format pretty --bundle o1.tar.gz --input test/cli/smoke/input.json data.test.result --fail
opa build --optimize 2 --output o2.tar.gz test/cli/smoke/test.rego
opa eval --format pretty --bundle o2.tar.gz --input test/cli/smoke/input.json data.test.result --fail


text:
if [ "$SKIP_PROPERTIES_BUILDER" = true ]; then
  echo "Skipping properties builder"
  exit 0
fi

# mongo container provides the HOST/PORT
# api container provided DB Name, ID & PWD

if [ "$TEST_SCRIPT" != "" ]
then
        #for testing locally
        PROP_FILE=application.properties
else
	PROP_FILE=config/hygieia-gitlab-scm-collector.properties
fi

if [ "$MONGO_PORT" != "" ]; then
	# Sample: MONGO_PORT=tcp://172.17.0.20:27017
	MONGODB_HOST=`echo $MONGO_PORT|sed 's;.*://\([^:]*\):\(.*\);\1;'`
	MONGODB_PORT=`echo $MONGO_PORT|sed 's;.*://\([^:]*\):\(.*\);\2;'`
else
	env
	echo "ERROR: MONGO_PORT not defined"
	exit 1
fi

echo "MONGODB_HOST: $MONGODB_HOST"
echo "MONGODB_PORT: $MONGODB_PORT"

cat > $PROP_FILE <<EOF
#Database Name
dbname=${HYGIEIA_API_ENV_SPRING_DATA_MONGODB_DATABASE:-dashboarddb}

#Database HostName - default is localhost
dbhost=${MONGODB_HOST:-10.0.1.1}

#Database Port - default is 27017
dbport=${MONGODB_PORT:-27017}

#Database Username - default is blank
dbusername=${HYGIEIA_API_ENV_SPRING_DATA_MONGODB_USERNAME:-dashboarduser}

#Database Password - default is blank
dbpassword=${HYGIEIA_API_ENV_SPRING_DATA_MONGODB_PASSWORD:-dbpassword}

#Collector schedule (required)
gitlab.cron=${GITLAB_CRON:-0 0/5 * * * *}

#Gitlab host (optional, defaults to "gitlab.com")
gitlab.host=${GITLAB_HOST:-}

#Gitlab protocol (optional, defaults to "http")
gitlab.protocol=${GITLAB_PROTOCOL:-}

#Gitlab port (optional, defaults to protocol default port)
gitlab.port=${GITLAB_PORT:-}

#Gitlab path (optional, defaults to no path)
gitlab.path=${GITLAB_PATH:-}

#Gitlab API Token (required, access token can be retrieved through gitlab, collector will have the permissions of the user associated to the token)
gitlab.apiToken=${GITLAB_API_TOKEN:-}

#Maximum number of days to go back in time when fetching commits
gitlab.commitThresholdDays=${GITLAB_COMMIT_THRESHOLD_DAYS:-15}

#Gitlab Instance using self signed certificate
gitlab.selfSignedCertificate=${GITLAB_SELF_SIGNED_CERTIFICATE:-false}

#Gitlab API Version (optional, defaults to current version of 4)
gitlab.apiVersion=${GITLAB_API_VERSION:-4}

EOF

echo "

===========================================
Properties file created `date`:  $PROP_FILE
Note: passwords hidden
===========================================
`cat $PROP_FILE |egrep -vi password`
 "

exit 0


text:
using Microsoft.Owin;
using Owin;

[assembly: OwinStartupAttribute(typeof(MyMarket.Web.Startup))]
namespace MyMarket.Web
{
    public partial class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            ConfigureAuth(app);
        }
    }
}


text:
function init_mp(){
  if(!holodeck || !ChatDialogue || holodeck._chat_commands.mostplayed)
    return;

  holodeck.addChatCommand("mostplayed", function(l,n){
    var matchArr = n.match(/\/\S+\s+(\d+)/),
        dialog = l.activeDialogue(),
        gamesCount = 5,
        userList = $A(l.chatWindow().activeRoom().users()),
        usersCount = userList.length;

    if(matchArr && matchArr[1]) gamesCount = matchArr[1];

    function p(count){
      return count == 1?"":"s";
    }

    function makeLink(user){
      return '' + user + '';
    }

    var games = $H();
    userList.each(function(user){
      var o = user._game_url;
      if(!games.get(o)){
        games.set(o, {
          title: user._game_title,
          count: 0,
          user: "",
          url: o
        });
      }
      games.get(o).count++;
      games.get(o).user = user.username
    })

    var countArr = games.values().sort(function(a,b){
      return +b.count - +a.count;
    }).slice(0, gamesCount);
    var totalCount = games.size();

    dialog.unsanitizedKongBotMessage(usersCount + " user" + p(usersCount) + " playing " +
                                                 totalCount + " different game" + p(totalCount));

    dialog.unsanitizedKongBotMessage(gamesCount + " most played game" + p(gamesCount) + ":");

    countArr.each(function(obj){
      dialog.unsanitizedKongBotMessage(
        obj.count + " user" + p(obj.count) + " (" +
        (obj.count > 1 ? "" : makeLink(obj.user) + ", ") +
        (100*obj.count/usersCount).toFixed(1) + "%) " +
        (obj.count > 1 ? "are" : "is") + ' playing ' + obj.title + ""
      );
    });

    return false;
  });

  holodeck._chat_commands.mp = holodeck._chat_commands.mostplayed;

  ChatDialogue.prototype.unsanitizedKongBotMessage = function(message){
    this.displayUnsanitizedMessage("Kong Bot", message, {class: "whisper received_whisper"}, {non_user: true});
  }
}

runWhenReady(init_mp);


text:
#include "audio/voip/audio_ingress.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/call/transport.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "audio/voip/audio_egress.h"
#include "modules/audio_mixer/sine_wave_generator.h"
#include "rtc_base/event.h"
#include "rtc_base/logging.h"
#include "test/gmock.h"
#include "test/gtest.h"
#include "test/mock_transport.h"

namespace webrtc {
namespace {

using ::testing::Invoke;
using ::testing::NiceMock;
using ::testing::Unused;

constexpr int16_t kAudioLevel = 3004;  // Used for sine wave level.

class AudioIngressTest : public ::testing::Test {
 public:
  const SdpAudioFormat kPcmuFormat = {"pcmu", 8000, 1};

  AudioIngressTest()
      : fake_clock_(123456789), wave_generator_(1000.0, kAudioLevel) {
    receive_statistics_ = ReceiveStatistics::Create(&fake_clock_);

    RtpRtcp::Configuration rtp_config;
    rtp_config.clock = &fake_clock_;
    rtp_config.audio = true;
    rtp_config.receive_statistics = receive_statistics_.get();
    rtp_config.rtcp_report_interval_ms = 5000;
    rtp_config.outgoing_transport = &transport_;
    rtp_config.local_media_ssrc = 0xdeadc0de;
    rtp_rtcp_ = RtpRtcp::Create(rtp_config);

    rtp_rtcp_->SetSendingMediaStatus(false);
    rtp_rtcp_->SetRTCPStatus(RtcpMode::kCompound);

    task_queue_factory_ = CreateDefaultTaskQueueFactory();
    encoder_factory_ = CreateBuiltinAudioEncoderFactory();
    decoder_factory_ = CreateBuiltinAudioDecoderFactory();
  }

  void SetUp() override {
    constexpr int kPcmuPayload = 0;
    ingress_ = std::make_unique<AudioIngress>(rtp_rtcp_.get(), &fake_clock_,
                                              receive_statistics_.get(),
                                              decoder_factory_);
    ingress_->SetReceiveCodecs({{kPcmuPayload, kPcmuFormat}});

    egress_ = std::make_unique<AudioEgress>(rtp_rtcp_.get(), &fake_clock_,
                                            task_queue_factory_.get());
    egress_->SetEncoder(kPcmuPayload, kPcmuFormat,
                        encoder_factory_->MakeAudioEncoder(
                            kPcmuPayload, kPcmuFormat, absl::nullopt));
    egress_->StartSend();
    ingress_->StartPlay();
    rtp_rtcp_->SetSendingStatus(true);
  }

  void TearDown() override {
    rtp_rtcp_->SetSendingStatus(false);
    ingress_->StopPlay();
    egress_->StopSend();
    egress_.reset();
    ingress_.reset();
  }

  std::unique_ptr<AudioFrame> GetAudioFrame(int order) {
    auto frame = std::make_unique<AudioFrame>();
    frame->sample_rate_hz_ = kPcmuFormat.clockrate_hz;
    frame->samples_per_channel_ = kPcmuFormat.clockrate_hz / 100;  // 10 ms.
    frame->num_channels_ = kPcmuFormat.num_channels;
    frame->timestamp_ = frame->samples_per_channel_ * order;
    wave_generator_.GenerateNextFrame(frame.get());
    return frame;
  }

  SimulatedClock fake_clock_;
  SineWaveGenerator wave_generator_;
  NiceMock<MockTransport> transport_;
  std::unique_ptr<ReceiveStatistics> receive_statistics_;
  std::unique_ptr<RtpRtcp> rtp_rtcp_;
  rtc::scoped_refptr<AudioEncoderFactory> encoder_factory_;
  rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_;
  std::unique_ptr<TaskQueueFactory> task_queue_factory_;
  std::unique_ptr<AudioIngress> ingress_;
  std::unique_ptr<AudioEgress> egress_;
};

TEST_F(AudioIngressTest, PlayingAfterStartAndStop) {
  EXPECT_EQ(ingress_->IsPlaying(), true);
  ingress_->StopPlay();
  EXPECT_EQ(ingress_->IsPlaying(), false);
}

TEST_F(AudioIngressTest, GetAudioFrameAfterRtpReceived) {
  rtc::Event event;
  auto handle_rtp = [&](const uint8_t* packet, size_t length, Unused) {
    ingress_->ReceivedRTPPacket(rtc::ArrayView<const uint8_t>(packet, length));
    event.Set();
    return true;
  };
  EXPECT_CALL(transport_, SendRtp).WillRepeatedly(Invoke(handle_rtp));
  egress_->SendAudioData(GetAudioFrame(0));
  egress_->SendAudioData(GetAudioFrame(1));
  event.Wait(/*ms=*/1000);

  AudioFrame audio_frame;
  EXPECT_EQ(
      ingress_->GetAudioFrameWithInfo(kPcmuFormat.clockrate_hz, &audio_frame),
      AudioMixer::Source::AudioFrameInfo::kNormal);
  EXPECT_FALSE(audio_frame.muted());
  EXPECT_EQ(audio_frame.num_channels_, 1u);
  EXPECT_EQ(audio_frame.samples_per_channel_,
            static_cast<size_t>(kPcmuFormat.clockrate_hz / 100));
  EXPECT_EQ(audio_frame.sample_rate_hz_, kPcmuFormat.clockrate_hz);
  EXPECT_NE(audio_frame.timestamp_, 0u);
  EXPECT_EQ(audio_frame.elapsed_time_ms_, 0);
}

TEST_F(AudioIngressTest, GetSpeechOutputLevelFullRange) {
  // Per audio_level's kUpdateFrequency, we need 11 RTP to get audio level.
  constexpr int kNumRtp = 11;
  int rtp_count = 0;
  rtc::Event event;
  auto handle_rtp = [&](const uint8_t* packet, size_t length, Unused) {
    ingress_->ReceivedRTPPacket(rtc::ArrayView<const uint8_t>(packet, length));
    if (++rtp_count == kNumRtp) {
      event.Set();
    }
    return true;
  };
  EXPECT_CALL(transport_, SendRtp).WillRepeatedly(Invoke(handle_rtp));
  for (int i = 0; i < kNumRtp * 2; i++) {
    egress_->SendAudioData(GetAudioFrame(i));
    fake_clock_.AdvanceTimeMilliseconds(10);
  }
  event.Wait(/*ms=*/1000);

  for (int i = 0; i < kNumRtp; ++i) {
    AudioFrame audio_frame;
    EXPECT_EQ(
        ingress_->GetAudioFrameWithInfo(kPcmuFormat.clockrate_hz, &audio_frame),
        AudioMixer::Source::AudioFrameInfo::kNormal);
  }
  EXPECT_EQ(ingress_->GetSpeechOutputLevelFullRange(), kAudioLevel);
}

TEST_F(AudioIngressTest, PreferredSampleRate) {
  rtc::Event event;
  auto handle_rtp = [&](const uint8_t* packet, size_t length, Unused) {
    ingress_->ReceivedRTPPacket(rtc::ArrayView<const uint8_t>(packet, length));
    event.Set();
    return true;
  };
  EXPECT_CALL(transport_, SendRtp).WillRepeatedly(Invoke(handle_rtp));
  egress_->SendAudioData(GetAudioFrame(0));
  egress_->SendAudioData(GetAudioFrame(1));
  event.Wait(/*ms=*/1000);

  AudioFrame audio_frame;
  EXPECT_EQ(
      ingress_->GetAudioFrameWithInfo(kPcmuFormat.clockrate_hz, &audio_frame),
      AudioMixer::Source::AudioFrameInfo::kNormal);
  EXPECT_EQ(ingress_->PreferredSampleRate(), kPcmuFormat.clockrate_hz);
}

}  // namespace
}  // namespace webrtc


text:
@interface BIButtonHandler : NSObject <BIBuilderHandler>
@end


text:
#if defined(_WIN_)
#include "dhcore/win.h"
#endif

#include <stdio.h>
#include <stdarg.h>

#include "dhcore/mem-mgr.h"
#include "dhcore/log.h"
#include "dhcore/mt.h"
#include "dhcore/util.h"
#include "dhcore/str.h"

#define LINE_COUNT_FLUSH    20

/* fwd declarations */
static void log_outputtext(enum log_type type, const char* text);

/* types */
struct log_mgr
{
    struct log_stats stats;
    uint outputs;
    char log_filepath[DH_PATH_MAX];
    FILE* log_file;
    pfn_log_handler log_fn;
    void* fn_param;

#ifdef _WIN_
    HANDLE con_hdl;
    WORD con_attrs;
#endif
};

enum output_mode
{
    OUTPUT_CONSOLE = (1<<0),
    OUTPUT_DEBUGGER = (1<<1),
    OUTPUT_FILE = (1<<2),
    OUTPUT_CUSTOM = (1<<3)
};

/* globals */
static struct log_mgr* g_log = NULL;

/*************************************************************************************************/
result_t log_init()
{
    if (g_log != NULL)
        return RET_FAIL;
    g_log = (struct log_mgr*)ALLOC(sizeof(struct log_mgr), 0);
    if (g_log == NULL)
        return RET_OUTOFMEMORY;
    memset(g_log, 0x00, sizeof(struct log_mgr));

    return RET_OK;
}

void log_release()
{
    if (g_log != NULL)  {
        if (g_log->log_file != NULL)
            fclose(g_log->log_file);

        FREE(g_log);
        g_log = NULL;
    }
}

result_t log_outputconsole(int enable)
{
    if (enable)
    	BIT_ADD(g_log->outputs, OUTPUT_CONSOLE);
    else
    	BIT_REMOVE(g_log->outputs, OUTPUT_CONSOLE);

#ifdef _WIN_
    if (enable) {
        g_log->con_hdl = GetStdHandle(STD_OUTPUT_HANDLE);
        CONSOLE_SCREEN_BUFFER_INFO con_info;
        GetConsoleScreenBufferInfo(g_log->con_hdl, &con_info);
        g_log->con_attrs = con_info.wAttributes;
    }   else    {
        if (g_log->con_hdl) {
            SetConsoleTextAttribute(g_log->con_hdl, g_log->con_attrs);
            CloseHandle(g_log->con_hdl);
        }
    }
#endif
    return RET_OK;
}

result_t log_outputfile(int enable, const char* log_filepath)
{
    BIT_ADD(g_log->outputs, OUTPUT_FILE);

    /* if logfile is previously opened, close it */
    if (g_log->log_file != NULL)     {
        fclose(g_log->log_file);
        g_log->log_file = NULL;
        BIT_REMOVE(g_log->outputs, OUTPUT_FILE);
    }

    if (enable)     {
        g_log->log_file = fopen(log_filepath, "wt");
        if (g_log->log_file == NULL)
            return RET_FILE_ERROR;

        BIT_ADD(g_log->outputs, OUTPUT_FILE);
        strcpy(g_log->log_filepath, log_filepath);
    }

    return RET_OK;
}

result_t log_outputdebugger(int enable)
{
    if (enable)
    	BIT_ADD(g_log->outputs, OUTPUT_DEBUGGER);
    else
    	BIT_REMOVE(g_log->outputs, OUTPUT_DEBUGGER);

    return RET_OK;
}

result_t log_outputfunc(int enable, pfn_log_handler log_fn, void* param)
{
    if (enable)     {
        BIT_ADD(g_log->outputs, OUTPUT_CUSTOM);
        g_log->log_fn = log_fn;
        g_log->fn_param = param;
    }    else       {
        BIT_REMOVE(g_log->outputs, OUTPUT_CUSTOM);
        g_log->log_fn = NULL;
        g_log->fn_param = NULL;
    }

    return RET_OK;
}

int log_isconsole()
{
    return BIT_CHECK(g_log->outputs, OUTPUT_CONSOLE);
}

int log_isfile()
{
    return BIT_CHECK(g_log->outputs, OUTPUT_FILE);
}

int log_isdebugger()
{
    return BIT_CHECK(g_log->outputs, OUTPUT_DEBUGGER);
}

int log_isoutputfunc()
{
    return BIT_CHECK(g_log->outputs, OUTPUT_CUSTOM);
}

void log_print(enum log_type type, const char* text)
{
    log_outputtext(type, text);
}

void log_printf(enum log_type type, const char* fmt, ...)
{
    char text[2048];
    text[0] = 0;

    va_list args;
    va_start(args, fmt);
    vsnprintf(text, sizeof(text), fmt, args);
    va_end(args);

    log_outputtext(type, text);
}

void log_getstats(struct log_stats* stats)
{
    memcpy(stats, &g_log->stats, sizeof(g_log->stats));
}

void log_endprogress(enum log_progress_result res)
{
#ifndef _WIN_
    const char *text;

    switch (res)    {
    case LOG_PROGRESS_OK:
        text = "[" TERM_GREEN "OK" TERM_RESET "]";
        break;
    case LOG_PROGRESS_FATAL:
        text = "[" TERM_BOLDRED "FAILED" TERM_RESET "]";
        break;
    case LOG_PROGRESS_NONFATAL:
        text = "[" TERM_BOLDYELLOW "FAILED" TERM_RESET "]";
        break;
    default:
        text = "";
        break;
    }
    log_outputtext(LOG_PROGRESS_RESULT, text);
#endif
}

static void log_outputtext(enum log_type type, const char* text)
{
    const char* prefix;
    char msg[2048];

    switch (type)   {
        case LOG_ERROR:
            prefix = "";
            MT_ATOMIC_INCR(g_log->stats.errors_cnt);
            break;

        case LOG_WARNING:
            prefix = "";
            MT_ATOMIC_INCR(g_log->stats.warnings_cnt);
            break;

        case LOG_LOAD:
            prefix = "Load: ";
            break;

        default:
            prefix = "";
            break;
    }

    MT_ATOMIC_INCR(g_log->stats.msgs_cnt);
    strcpy(msg, prefix);
    str_safecat(msg, sizeof(msg)-1, text);

    /* message is ready, dispatch it to outputs */
    if (BIT_CHECK(g_log->outputs, OUTPUT_CONSOLE))   {
#if !defined(_WIN_)
        char msg2[2060];
        const char* color;
        switch (type)   {
        case LOG_ERROR:
            color = TERM_RED;
            break;
        case LOG_WARNING:
            color = TERM_YELLOW;
            break;
        case LOG_INFO:
            color = TERM_DIM;
            break;
        case LOG_LOAD:
            color = TERM_DIMCYAN;
            break;
        case LOG_TEXT:
        case LOG_PROGRESS:
        case LOG_PROGRESS_RESULT:
            color = TERM_RESET;
            break;
        default:
            color = "";
        }

        strcpy(msg2, color);
        strcat(msg2, msg);
        strcat(msg2, TERM_RESET);

        if (type != LOG_PROGRESS)
            puts(msg2);
        else if (type == LOG_PROGRESS_RESULT)
            puts(msg2);
        else
            printf("%-" LOG_STDOUT_PADDING "s", msg2);
#else
        ASSERT(g_log->con_hdl);
        switch (type)   {
        case LOG_ERROR:
            SetConsoleTextAttribute(g_log->con_hdl, FOREGROUND_RED|FOREGROUND_INTENSITY);
            break;
        case LOG_WARNING:
            SetConsoleTextAttribute(g_log->con_hdl, FOREGROUND_RED|FOREGROUND_GREEN);
            break;
        case LOG_TEXT:
        case LOG_PROGRESS:
            SetConsoleTextAttribute(g_log->con_hdl,
                FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY);
            break;
        case LOG_PROGRESS_RESULT:
        case LOG_INFO:
            SetConsoleTextAttribute(g_log->con_hdl, g_log->con_attrs);
            break;
        case LOG_LOAD:
            SetConsoleTextAttribute(g_log->con_hdl, FOREGROUND_BLUE);
            break;
        }
        puts(msg);
        SetConsoleTextAttribute(g_log->con_hdl, g_log->con_attrs);
#endif
    }

    if (type != LOG_PROGRESS)
        strcat(msg, "\n");

    if (BIT_CHECK(g_log->outputs, OUTPUT_FILE))  {
        fputs(msg, g_log->log_file);
        fflush(g_log->log_file);
    }

#if defined(_MSVC_) && defined(_DEBUG_)
    if (BIT_CHECK(g_log->outputs, OUTPUT_DEBUGGER))
        OutputDebugString(msg);
#endif

    if (BIT_CHECK(g_log->outputs, OUTPUT_CUSTOM))
        g_log->log_fn(type, msg, g_log->fn_param);
}


text:
namespace process {

// Data necessary for polling so we can discard polling and actually
// stop it in the event loop.
struct Poll
{
  Poll()
  {
    // Need to explicitly instantiate the watchers.
    watcher.io.reset(new ev_io());
    watcher.async.reset(new ev_async());
  }

  // An I/O watcher for checking for readability or writeability and
  // an async watcher for being able to discard the polling.
  struct {
    std::shared_ptr<ev_io> io;
    std::shared_ptr<ev_async> async;
  } watcher;

  Promise<short> promise;
};

// Event loop callback when I/O is ready on polling file descriptor.
void polled(struct ev_loop* loop, ev_io* watcher, int revents)
{
  Poll* poll = (Poll*) watcher->data;

  ev_io_stop(loop, poll->watcher.io.get());

  // Stop the async watcher (also clears if pending so 'discard_poll'
  // will not get invoked and we can delete 'poll' here).
  ev_async_stop(loop, poll->watcher.async.get());

  poll->promise.set(revents);

  delete poll;
}

// Event loop callback when future associated with polling file
// descriptor has been discarded.
void discard_poll(struct ev_loop* loop, ev_async* watcher, int revents)
{
  Poll* poll = (Poll*) watcher->data;

  // Check and see if we have a pending 'polled' callback and if so
  // let it "win".
  if (ev_is_pending(poll->watcher.io.get())) {
    return;
  }

  ev_async_stop(loop, poll->watcher.async.get());

  // Stop the I/O watcher (but note we check if pending above) so it
  // won't get invoked and we can delete 'poll' here.
  ev_io_stop(loop, poll->watcher.io.get());

  poll->promise.discard();

  delete poll;
}

namespace io {
namespace internal {

// Helper/continuation of 'poll' on future discard.
void _poll(const std::shared_ptr<ev_async>& async)
{
  ev_async_send(loop, async.get());
}

Future<short> poll(int_fd fd, short events)
{
  Poll* poll = new Poll();

  // Have the watchers data point back to the struct.
  poll->watcher.async->data = poll;
  poll->watcher.io->data = poll;

  // Get a copy of the future to avoid any races with the event loop.
  Future<short> future = poll->promise.future();

  // Initialize and start the async watcher.
  ev_async_init(poll->watcher.async.get(), discard_poll);
  ev_async_start(loop, poll->watcher.async.get());

  // Make sure we stop polling if a discard occurs on our future.
  // Note that it's possible that we'll invoke '_poll' when someone
  // does a discard even after the polling has already completed, but
  // in this case while we will interrupt the event loop since the
  // async watcher has already been stopped we won't cause
  // 'discard_poll' to get invoked.
  future.onDiscard(lambda::bind(&_poll, poll->watcher.async));

  // Initialize and start the I/O watcher.
  ev_io_init(poll->watcher.io.get(), polled, fd, events);
  ev_io_start(loop, poll->watcher.io.get());

  return future;
}

} // namespace internal {

Future<short> poll(int_fd fd, short events)
{
  process::initialize();

  // TODO(benh): Check if the file descriptor is non-blocking?

  return run_in_event_loop<short>(lambda::bind(&internal::poll, fd, events));
}

} // namespace io {
} // namespace process {