コード例 #1
0
ファイル: main.cpp プロジェクト: CCJY/coliru
int main()
{
    double d = 123.456789 ;
    const auto bytes = to_bytes(d) ;

    std::cout << std::hex << std::setfill('0') ;
    for( byte b : bytes ) std::cout << std::setw(2) << int(b) << ' ' ;
    std::cout << '\n' ;

    d = 0 ;
    from_bytes( bytes, d ) ;
    std::cout << std::fixed << d << '\n' ;

    int arr[] = { 1, 63, 256, 511, 1024 } ;
    const auto array_bytes = to_bytes(arr) ;

    for( byte b : array_bytes ) std::cout << std::setw(2) << int(b) << ' ' ;
    std::cout << '\n' ;

    for( int& v : arr ) v = -1 ;
    from_bytes( array_bytes, arr ) ;
    for( int v : arr ) std::cout << std::dec << v << ' ' ;
    std::cout << '\n' ;
}
コード例 #2
0
ファイル: page.cpp プロジェクト: feldsherov/techsphere_DB
Page::Page(const char *src) {
    from_bytes(src);
}