karalabe / xgo

Go CGO cross compiler
MIT License
2.14k stars 280 forks source link

error: no member named 'end' in namespace 'std' #162

Closed Timmy-crypto closed 4 years ago

Timmy-crypto commented 5 years ago

There will be an error generated when the std:end was used in the code

The code is as below:

#include "print128.h"

#include <stdint.h>
#include <iterator>

const char* printi128(uint64_t lo, uint64_t hi) {
    __int128 u = hi;
    u <<= 64;
    u |= lo;

    unsigned __int128 tmp = u < 0 ? -u : u;
    static char buffer[128+1];
    buffer[sizeof(buffer)-1] = '\0';
    char* d = std::end(buffer)-1;
    do
    {
        --d;
        *d = "0123456789"[ tmp % 10 ];
        tmp /= 10;
    } while ( tmp != 0 );
    if ( u < 0 ) {
        --d;
        *d = '-';
    }

    return d;
}

The compile info and err:

TERM='dumb' o64-clang++ -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK/b002=/tmp/go-build -gno-record-gcc-switches -fno-common -I $WORK/b002/ -g -O2 -std=c++14 -o $WORK/b002/_x003.o -c print128.cpp
#github.com/yangchuang123456/xgo-test/resolver
print128.cpp:14:20: error: no member named 'end' in namespace 'std'

So i wan't to know if xgo support c++11. Could you please help me resolve the problem Waiting for your responce