当前位置: 首页>>代码示例>>C++>>正文


C++ Strings::back方法代码示例

本文整理汇总了C++中Strings::back方法的典型用法代码示例。如果您正苦于以下问题:C++ Strings::back方法的具体用法?C++ Strings::back怎么用?C++ Strings::back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Strings的用法示例。


在下文中一共展示了Strings::back方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _startLocalServer

co::ConnectionPtr _startLocalServer()
{
    Strings dirNames;
    dirNames.push_back( "" );
    dirNames.push_back( "./" );
// Add path of current .so so search paths for EqualizerServer    
#ifndef _WIN32
    Dl_info dl_info;
    dladdr((void *)_startLocalServer, &dl_info);
    
    char libPath[1024];
    strncpy(libPath, dl_info.dli_fname, 1024);
    char* k = strrchr(libPath, '/');
    *(k + 1) = '\0';
    dirNames.push_back( libPath );
#endif
#ifdef EQ_BUILD_DIR
#ifdef NDEBUG
    dirNames.push_back( std::string( EQ_BUILD_DIR ) + "libs/server/Release/" );
#else
    dirNames.push_back( std::string( EQ_BUILD_DIR ) + "libs/server/Debug/" );
#endif
    dirNames.push_back( std::string( EQ_BUILD_DIR ) + "libs/server/" );
#endif

#ifdef _MSC_VER
    const std::string libName = "EqualizerServer.dll";
#elif defined (_WIN32)
    const std::string libName = "libEqualizerServer.dll";
#elif defined (Darwin)
    const std::string libName = "libEqualizerServer.dylib";
#else
    const std::string libName = "libEqualizerServer.so";
#endif

    while( !_libeqserver.isOpen() && !dirNames.empty( ))
    {
        _libeqserver.open( dirNames.back() + libName );
        dirNames.pop_back();
    }

    if( !_libeqserver.isOpen( ))
    {
        EQWARN << "Can't open Equalizer server library" << std::endl;
        return 0;
    }

    eqsStartLocalServer_t eqsStartLocalServer = (eqsStartLocalServer_t)
        _libeqserver.getFunctionPointer( "eqsStartLocalServer" );

    if( !eqsStartLocalServer )
    {
        EQWARN << "Can't find server entry function eqsStartLocalServer"
               << std::endl;
        return 0;
    }

    return eqsStartLocalServer( Global::getConfigFile( ));
}
开发者ID:omega-hub,项目名称:Equalizer-1.0.2,代码行数:59,代码来源:client.cpp

示例2: _startLocalServer

co::ConnectionPtr _startLocalServer()
{
    Strings dirNames;
    dirNames.push_back( "" );

#ifdef EQ_BUILD_DIR
#ifdef NDEBUG
    dirNames.push_back( std::string( EQ_BUILD_DIR ) + "lib/Release/" );
#else
    dirNames.push_back( std::string( EQ_BUILD_DIR ) + "lib/Debug/" );
#endif
    dirNames.push_back( std::string( EQ_BUILD_DIR ) + "lib/" );
#endif

#ifdef _MSC_VER
    const std::string libName = "EqualizerServer.dll";
#elif defined (_WIN32)
    const std::string libName = "libEqualizerServer.dll";
#elif defined (Darwin)
    const std::string libName = "libEqualizerServer.dylib";
#else
    const std::string libName = "libEqualizerServer.so";
#endif

    while( !_libeqserver.isOpen() && !dirNames.empty( ))
    {
        _libeqserver.open( dirNames.back() + libName );
        dirNames.pop_back();
    }

    if( !_libeqserver.isOpen( ))
    {
        LBWARN << "Can't open Equalizer server library" << std::endl;
        return 0;
    }

    eqsStartLocalServer_t eqsStartLocalServer = (eqsStartLocalServer_t)
        _libeqserver.getFunctionPointer( "eqsStartLocalServer" );

    if( !eqsStartLocalServer )
    {
        LBWARN << "Can't find server entry function eqsStartLocalServer"
               << std::endl;
        return 0;
    }

    return eqsStartLocalServer( Global::getConfigFile( ));
}
开发者ID:maxmah,项目名称:Equalizer,代码行数:48,代码来源:client.cpp

示例3: main

int main(int argc, char ** argv)
{
	using Strings = std::vector<std::string>;
	using Hashes = std::vector<char>;
	Strings strings;
	size_t rows = 0;
	size_t bytes = 0;

	{
		Stopwatch watch;

		DB::ReadBufferFromFileDescriptor in(STDIN_FILENO);

		while (!in.eof())
		{
			strings.push_back(std::string());
			DB::readEscapedString(strings.back(), in);
			DB::assertChar('\n', in);
			bytes += strings.back().size() + 1;
		}

		watch.stop();
		rows = strings.size();
		std::cerr << std::fixed << std::setprecision(2)
			<< "Read " << rows << " rows, " << bytes / 1000000.0 << " MB"
			<< ", elapsed: " << watch.elapsedSeconds()
			<< " (" << rows / watch.elapsedSeconds() << " rows/sec., " << bytes / 1000000.0 / watch.elapsedSeconds() << " MB/sec.)"
			<< std::endl;
	}

	Hashes hashes(16 * rows);

	{
		Stopwatch watch;

		for (size_t i = 0; i < rows; ++i)
		{
			*reinterpret_cast<UInt64*>(&hashes[i * 16]) = CityHash64(strings[i].data(), strings[i].size());
		}

		watch.stop();

		UInt64 check = CityHash64(&hashes[0], hashes.size());

		std::cerr << std::fixed << std::setprecision(2)
			<< "CityHash64 (check = " << check << ")"
			<< ", elapsed: " << watch.elapsedSeconds()
			<< " (" << rows / watch.elapsedSeconds() << " rows/sec., " << bytes / 1000000.0 / watch.elapsedSeconds() << " MB/sec.)"
			<< std::endl;
	}
	
/*	{
		Stopwatch watch;

		std::vector<char> seed(16);

		for (size_t i = 0; i < rows; ++i)
		{
			sipHash(
				reinterpret_cast<unsigned char *>(&hashes[i * 16]),
				reinterpret_cast<const unsigned char *>(strings[i].data()),
				strings[i].size(),
				reinterpret_cast<const unsigned char *>(&seed[0]));
		}

		watch.stop();

		UInt64 check = CityHash64(&hashes[0], hashes.size());

		std::cerr << std::fixed << std::setprecision(2)
			<< "SipHash (check = " << check << ")"
			<< ", elapsed: " << watch.elapsedSeconds()
			<< " (" << rows / watch.elapsedSeconds() << " rows/sec., " << bytes / 1000000.0 / watch.elapsedSeconds() << " MB/sec.)"
			<< std::endl;
	}*/

	{
		Stopwatch watch;

		for (size_t i = 0; i < rows; ++i)
		{
			SipHash hash;
			hash.update(strings[i].data(), strings[i].size());
			hash.get128(&hashes[i * 16]);
		}

		watch.stop();

		UInt64 check = CityHash64(&hashes[0], hashes.size());

		std::cerr << std::fixed << std::setprecision(2)
			<< "SipHash, stream (check = " << check << ")"
			<< ", elapsed: " << watch.elapsedSeconds()
			<< " (" << rows / watch.elapsedSeconds() << " rows/sec., " << bytes / 1000000.0 / watch.elapsedSeconds() << " MB/sec.)"
			<< std::endl;
	}

	{
		Stopwatch watch;

//.........这里部分代码省略.........
开发者ID:Aahart911,项目名称:ClickHouse,代码行数:101,代码来源:hashes_test.cpp


注:本文中的Strings::back方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。