std::string with a custom allocator
<p>So I'm currently in the process of writing a memory debugger and to do that I need stl container objects to use an untracked allocator.</p>

<p>I have std::string peppered throughout my entire codebase, so I typedef'd it to use my untracked allocator:</p>

<pre><code>typedef std::basic_string&lt;char, std::char_traits&lt;char&gt;, UntrackedAllocator&lt;char&gt;&gt; String;
</code></pre>

<p>Now when I try to do this:</p>

<pre><code>String str { "Some string" };
String copy = str;
</code></pre>

<p>I get this error:</p>

<pre><code>/usr/local/include/c++/7.1.0/ext/alloc_traits.h:95:67: error: no matching function for call to 'UntrackedAllocator&lt;char&gt;::UntrackedAllocator(UntrackedAllocator&lt;char&gt;)' { return _Base_type::select_on_container_copy_construction(__a); }
</code></pre>

<p>This is what my Untracked Allocator looks like:</p>

<pre><code>#pragma once

#define NOMINMAX
#undef max

template &lt;typename T&gt;
class UntrackedAllocator {
public:
    typedef T value_type;
    typedef value_type* pointer;
    typedef const value_type* const_pointer;
    typedef value_type&amp; reference;
    typedef const value_type&amp; const_reference;
    typedef std::size_t size_type;
    typedef std::ptrdiff_t difference_type;

public:
    template&lt;typename U&gt;
    struct rebind {
        typedef UntrackedAllocator&lt;U&gt; other;
    };

public:
    inline explicit UntrackedAllocator() {}
    inline ~UntrackedAllocator() {}
    inline explicit UntrackedAllocator(UntrackedAllocator const&amp;) {}
    template&lt;typename U&gt;
    inline explicit UntrackedAllocator(UntrackedAllocator&lt;U&gt; const&amp;) {}

    //    address
    inline pointer address(reference r) {
        return &amp;r;
    }

    inline const_pointer address(const_reference r) {
        return &amp;r;
    }

    //    memory allocation
    inline pointer allocate(size_type cnt,
        typename std::allocator&lt;void&gt;::const_pointer = 0) {
        T *ptr = (T*)malloc(cnt * sizeof(T));
        return ptr;
    }

    inline void deallocate(pointer p, size_type cnt) {
        free(p);
    }

    //   size
    inline size_type max_size() const {
        return std::numeric_limits&lt;size_type&gt;::max() / sizeof(T);
    }

    // construction/destruction
    inline void construct(pointer p, const T&amp; t) {
        new(p) T(t);
    }

    inline void destroy(pointer p) {
        p-&gt;~T();
    }

    inline bool operator==(UntrackedAllocator const&amp; a) { return this == &amp;a; }
    inline bool operator!=(UntrackedAllocator const&amp; a) { return !operator==(a); }
};
</code></pre>

<p>This is my first time working with custom allocators so I have no idea what's going on with it. It's incredibly annoyning that I can't do str1 = str2 if one of them uses a custom allocator. </p>