Exemple #1
0
    void eval(MonteCarloNode& n) {
        auto& b = n.board;
        auto sym = n.orientation;

        feats.fill(Features());
        oriented.fill(Features());
        extractFeatures(b,feats);
        dihedralTranspose(feats,oriented,sym);

        inVec.clear();
        convertToTCNNInput(oriented,inVec);

        result = &nn.fprop(inVec);
        std::vector<size_t> inds;
        inds.assign(n.moves.size(),0);

        double total = 0;
        for(size_t i = 0; i < n.moves.size(); ++i) {
            inds[i] = /*IX(n.moves[i]);*/IX(dihedral(n.moves[i],sym));
            total += (*result)[inds[i]];
        }

        for(size_t i = 0; i < n.moves.size(); ++i) {
            n.probabilities[i].store((*result)[inds[i]]/total);
        }

    }
Exemple #2
0
void update_ctrlkeys()
{
    SDL_PumpEvents();
    ctrlkeys.fill(0);
    auto r = SDL_GetModState();

    if (r & KMOD_RSHIFT)
        ctrlkeys[0] |= 1;

    if (r & KMOD_LSHIFT)
        ctrlkeys[0] |= 2;

    //if (r & KMOD_SCROLL)
    //    ctrlkeys[0] |= 16;

    if (r & KMOD_LALT)
        ctrlkeys[0] |= 16;

    // relocating this to right alt instead of left alt
    if (r & KMOD_RALT)
        ctrlkeys[0] |= 32;

    if (r & KMOD_CAPS)
        ctrlkeys[0] |= 64;
}
Exemple #3
0
bool Validator::isDisplayable(const Action::Type type)
{
    if (type == Action::Type::anyItem)
        return true;
    const auto displayedType = [this](Action::Type t) -> bool & {
        return displayedType_[static_cast<std::size_t>(t)];
    };

    if (! checkedType_) {
        displayedType_.fill(true);
        for (const QString & name : itemNames_) {
            if (QFileInfo(commonItemPrefix_ + name).isDir()) {
                displayedType(Action::Type::file) = false;
                if (! displayedType(Action::Type::directory))
                    break; // both file and dir were found.
            }
            else {
                displayedType(Action::Type::directory) = false;
                if (! displayedType(Action::Type::file))
                    break; // both file and dir were found.
            }
        }
        checkedType_ = true;
    }
    return displayedType(type);
}
void
Module::registerMembaseFunctions()
{
   sMemArenas.fill(nullptr);

   RegisterKernelFunction(MEMGetBaseHeapHandle);
   RegisterKernelFunction(MEMSetBaseHeapHandle);
   RegisterKernelFunction(MEMGetArena);
   RegisterKernelFunction(MEMiInitHeapHead);
   RegisterKernelFunction(MEMiFinaliseHeap);
   RegisterKernelFunction(MEMFindContainHeap);
   RegisterKernelFunction(MEMDumpHeap);

   RegisterKernelDataName("MEMAllocFromDefaultHeap", pMEMAllocFromDefaultHeap);
   RegisterKernelDataName("MEMAllocFromDefaultHeapEx", pMEMAllocFromDefaultHeapEx);
   RegisterKernelDataName("MEMFreeToDefaultHeap", pMEMFreeToDefaultHeap);

   RegisterInternalFunction(internal::defaultAllocFromDefaultHeap, sDefaultMEMAllocFromDefaultHeap);
   RegisterInternalFunction(internal::defaultAllocFromDefaultHeapEx, sDefaultMEMAllocFromDefaultHeapEx);
   RegisterInternalFunction(internal::defaultFreeToDefaultHeap, sDefaultMEMFreeToDefaultHeap);

   RegisterInternalData(sForegroundMemlist);
   RegisterInternalData(sMEM1Memlist);
   RegisterInternalData(sMEM2Memlist);
}
		void clear() {
			csi = false;
			state = State::Ground;
			postfix = '\0';
			parms.fill(0);
			inside.clear();
			parm_count = 0;
		}
Exemple #6
0
 explicit
 InverseAlphabet(std::string const& digits)
 {
     map_.fill(-1);
     int i = 0;
     for(auto const c : digits)
         map_[static_cast<
             unsigned char>(c)] = i++;
 }
Exemple #7
0
bool hist(cv::Mat img, std::array<unsigned int, 256>& bins) {
	assert(img.type() == CV_8UC1);
	bins.fill(0);

	for(int row = 0; row < img.rows; ++row) {
	    uchar* p = img.ptr(row);
	    for(int col = 0; col < img.cols; ++col) {
	         ++bins[*p++];  //points to each pixel value in turn assuming a CV_8UC1 greyscale image
	    }
	}
	return true;
}
Exemple #8
0
static bool WipeFile(const string& Name, int TotalPercent, bool& Cancel, ConsoleTitle* DeleteTitle)
{
	bool Result = false;

	api::SetFileAttributes(Name,FILE_ATTRIBUTE_NORMAL);

	api::FileWalker WipeFile;

	if(WipeFile.Open(Name, FILE_READ_DATA|FILE_WRITE_DATA, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_WRITE_THROUGH|FILE_FLAG_SEQUENTIAL_SCAN))
	{
		const DWORD BufSize=65536;
		if(WipeFile.InitWalk(BufSize))
		{
			static std::array<BYTE, BufSize> Buf;
			static bool BufInit = false;
			if(!BufInit)
			{
				Buf.fill(Global->Opt->WipeSymbol); // используем символ заполнитель
				BufInit = true;
			}

			DWORD StartTime=GetTickCount();
			do
			{
				DWORD Written;
				WipeFile.Write(Buf.data(), WipeFile.GetChunkSize(), Written);
				DWORD CurTime=GetTickCount();
				if (CurTime-StartTime>(DWORD)Global->Opt->RedrawTimeout)
				{
					StartTime=CurTime;

					if (CheckForEscSilent() && ConfirmAbortOp())
					{
						Cancel=true;
						return false;
					}

					ShellDeleteMsg(Name, DEL_WIPEPROCESS, TotalPercent, WipeFile.GetPercent(), DeleteTitle);
				}
			}
			while(WipeFile.Step());

			WipeFile.SetPointer(0,nullptr,FILE_BEGIN);
			WipeFile.SetEnd();
		}
		WipeFile.Close();
		string strTempName;
		FarMkTempEx(strTempName,nullptr,FALSE);
		Result = api::MoveFile(Name,strTempName) && api::DeleteFile(strTempName);
	}
	return Result;
}
Exemple #9
0
void ConfigCache::SaveConfig(const SConfig& config)
{
  valid = true;

  bCPUThread = config.bCPUThread;
  bJITFollowBranch = config.bJITFollowBranch;
  bEnableCheats = config.bEnableCheats;
  bSyncGPUOnSkipIdleHack = config.bSyncGPUOnSkipIdleHack;
  bFPRF = config.bFPRF;
  bAccurateNaNs = config.bAccurateNaNs;
  bMMU = config.bMMU;
  m_EnableJIT = config.m_DSPEnableJIT;
  bSyncGPU = config.bSyncGPU;
  iSyncGpuMaxDistance = config.iSyncGpuMaxDistance;
  iSyncGpuMinDistance = config.iSyncGpuMinDistance;
  fSyncGpuOverclock = config.fSyncGpuOverclock;
  bFastDiscSpeed = config.bFastDiscSpeed;
  bDSPHLE = config.bDSPHLE;
  bHLE_BS2 = config.bHLE_BS2;
  iSelectedLanguage = config.SelectedLanguage;
  cpu_core = config.cpu_core;
  Volume = config.m_Volume;
  m_EmulationSpeed = config.m_EmulationSpeed;
  strBackend = config.m_strVideoBackend;
  sBackend = config.sBackend;
  m_strGPUDeterminismMode = config.m_strGPUDeterminismMode;
  m_OCFactor = config.m_OCFactor;
  m_OCEnable = config.m_OCEnable;

  std::copy(std::begin(g_wiimote_sources), std::end(g_wiimote_sources), std::begin(iWiimoteSource));
  std::copy(std::begin(config.m_SIDevice), std::end(config.m_SIDevice), std::begin(Pads));
  std::copy(std::begin(config.m_EXIDevice), std::end(config.m_EXIDevice), std::begin(m_EXIDevice));

  bSetEmulationSpeed = false;
  bSetVolume = false;
  bSetWiimoteSource.fill(false);
  bSetPads.fill(false);
  bSetEXIDevice.fill(false);
}
Exemple #10
0
void ConfigCache::SaveConfig(const SConfig& config)
{
  valid = true;

  bCPUThread = config.bCPUThread;
  bEnableCheats = config.bEnableCheats;
  bSyncGPUOnSkipIdleHack = config.bSyncGPUOnSkipIdleHack;
  bFPRF = config.bFPRF;
  bAccurateNaNs = config.bAccurateNaNs;
  bMMU = config.bMMU;
  bDCBZOFF = config.bDCBZOFF;
  m_EnableJIT = config.m_DSPEnableJIT;
  bSyncGPU = config.bSyncGPU;
  bFastDiscSpeed = config.bFastDiscSpeed;
  bDSPHLE = config.bDSPHLE;
  bHLE_BS2 = config.bHLE_BS2;
  bProgressive = config.bProgressive;
  bPAL60 = config.bPAL60;
  iSelectedLanguage = config.SelectedLanguage;
  iCPUCore = config.iCPUCore;
  Volume = config.m_Volume;
  m_EmulationSpeed = config.m_EmulationSpeed;
  strBackend = config.m_strVideoBackend;
  sBackend = config.sBackend;
  m_strGPUDeterminismMode = config.m_strGPUDeterminismMode;
  m_wii_language = config.m_wii_language;

  std::copy(std::begin(g_wiimote_sources), std::end(g_wiimote_sources), std::begin(iWiimoteSource));
  std::copy(std::begin(config.m_SIDevice), std::end(config.m_SIDevice), std::begin(Pads));
  std::copy(std::begin(config.m_EXIDevice), std::end(config.m_EXIDevice), std::begin(m_EXIDevice));

  bSetEmulationSpeed = false;
  bSetVolume = false;
  bSetWiimoteSource.fill(false);
  bSetPads.fill(false);
  bSetEXIDevice.fill(false);
}
void
Module::initialiseMembase()
{
   sMemArenas.fill(nullptr);

   MEMInitList(sForegroundMemlist, offsetof(CommonHeap, link));
   MEMInitList(sMEM1Memlist, offsetof(CommonHeap, link));
   MEMInitList(sMEM2Memlist, offsetof(CommonHeap, link));

   CoreInitDefaultHeap();

   // TODO: getAddress should not be neccessary here...
   *pMEMAllocFromDefaultHeap = sDefaultMEMAllocFromDefaultHeap.getAddress();
   *pMEMAllocFromDefaultHeapEx = sDefaultMEMAllocFromDefaultHeapEx.getAddress();
   *pMEMFreeToDefaultHeap = sDefaultMEMFreeToDefaultHeap.getAddress();
}
int main( void ) {
	dm.fill(0);
	uint16_t max = 0;
	uint32_t num = 0;
	for (uint32_t i = 1; i < 1000000; ++i ){
		uint16_t v = collatz(i);
		dm.at(i-1) = v;
		if (v > max) {
			max = v;
			num = i;
		}
	}
	std::cout <<  num << std::endl;

	return 0;
};
Exemple #13
0
ResultCode FormatConfig() {
    ResultCode res = DeleteConfigNANDSaveFile();
    if (!res.IsSuccess())
        return res;
    // Delete the old data
    cfg_config_file_buffer.fill(0);
    // Create the header
    SaveFileConfig* config = reinterpret_cast<SaveFileConfig*>(cfg_config_file_buffer.data());
    // This value is hardcoded, taken from 3dbrew, verified by hardware, it's always the same value
    config->data_entries_offset = 0x455C;
    // Insert the default blocks
    res = CreateConfigInfoBlk(0x00050005, sizeof(STEREO_CAMERA_SETTINGS), 0xE,
                              reinterpret_cast<const u8*>(STEREO_CAMERA_SETTINGS.data()));
    if (!res.IsSuccess())
        return res;
    res = CreateConfigInfoBlk(0x00090001, sizeof(CONSOLE_UNIQUE_ID), 0xE,
                              reinterpret_cast<const u8*>(&CONSOLE_UNIQUE_ID));
    if (!res.IsSuccess())
        return res;
    res = CreateConfigInfoBlk(0x000F0004, sizeof(CONSOLE_MODEL), 0x8,
                              reinterpret_cast<const u8*>(&CONSOLE_MODEL));
    if (!res.IsSuccess())
        return res;
    res = CreateConfigInfoBlk(0x000A0002, sizeof(CONSOLE_LANGUAGE), 0xA, &CONSOLE_LANGUAGE);
    if (!res.IsSuccess())
        return res;
    res = CreateConfigInfoBlk(0x00070001, sizeof(SOUND_OUTPUT_MODE), 0xE, &SOUND_OUTPUT_MODE);
    if (!res.IsSuccess())
        return res;
    res = CreateConfigInfoBlk(0x000B0000, sizeof(COUNTRY_INFO), 0xE,
                              reinterpret_cast<const u8*>(&COUNTRY_INFO));
    if (!res.IsSuccess())
        return res;
    res = CreateConfigInfoBlk(0x000A0000, sizeof(CONSOLE_USERNAME_BLOCK), 0xE,
                              reinterpret_cast<const u8*>(&CONSOLE_USERNAME_BLOCK));
    if (!res.IsSuccess())
        return res;
    // Save the buffer to the file
    res = UpdateConfigNANDSavegame();
    if (!res.IsSuccess())
        return res;
    return RESULT_SUCCESS;
}
 void onMessageReceived(const error_code& ec, size_t nrBytes)
 {
     auto onMessageReceivedWrapper = [this](const error_code& ec,
                                            size_t nrBytes)
     {
         this->onMessageReceived(ec, nrBytes);
     };
     cout << "Received " << data_.data() << "\n";
     try
     {
     socket_.read_some(boost::asio::buffer(data_));
     socket_.async_read_some(boost::asio::buffer(data_),
                             onMessageReceivedWrapper);
     data_.fill(0);
     }
     catch(std::exception& e)
     {
         cout << e.what() << "\n";
     }
 }
void
Module::initialiseMembase()
{
   sSystemHeap = nullptr;
   sMemArenas.fill(nullptr);

   sForegroundMemlist = coreinit::internal::sysAlloc<MemoryList>();
   MEMInitList(sForegroundMemlist, offsetof(CommonHeap, link));

   sMEM1Memlist = coreinit::internal::sysAlloc<MemoryList>();
   MEMInitList(sMEM1Memlist, offsetof(CommonHeap, link));

   sMEM2Memlist = coreinit::internal::sysAlloc<MemoryList>();
   MEMInitList(sMEM2Memlist, offsetof(CommonHeap, link));

   CoreInitDefaultHeap();

   *pMEMAllocFromDefaultHeap = findExportAddress("internal_defaultAlloc");
   *pMEMAllocFromDefaultHeapEx = findExportAddress("internal_defaultAllocEx");
   *pMEMFreeToDefaultHeap = findExportAddress("internal_defaultFree");
}
void
Module::registerMembaseFunctions()
{
   sMemArenas.fill(nullptr);

   RegisterKernelFunction(MEMGetBaseHeapHandle);
   RegisterKernelFunction(MEMSetBaseHeapHandle);
   RegisterKernelFunction(MEMGetArena);
   RegisterKernelDataName("MEMAllocFromDefaultHeap", pMEMAllocFromDefaultHeap);
   RegisterKernelDataName("MEMAllocFromDefaultHeapEx", pMEMAllocFromDefaultHeapEx);
   RegisterKernelDataName("MEMFreeToDefaultHeap", pMEMFreeToDefaultHeap);
   RegisterKernelFunction(MEMiInitHeapHead);
   RegisterKernelFunction(MEMiFinaliseHeap);
   RegisterKernelFunction(MEMFindContainHeap);
   RegisterKernelFunction(MEMDumpHeap);

   // These are default implementations for function pointers, register as exports
   // so we will have function thunks generated
   RegisterKernelFunctionName("internal_defaultAlloc", coreinit::internal::defaultAllocFromDefaultHeap);
   RegisterKernelFunctionName("internal_defaultAllocEx", coreinit::internal::defaultAllocFromDefaultHeapEx);
   RegisterKernelFunctionName("internal_defaultFree", coreinit::internal::defaultFreeToDefaultHeap);
}
void
Module::initialiseExceptions()
{
   sExceptionCallbacks.fill(nullptr);
}
 TrieNode() : nearest_leaf{nullptr}, nearest_leaf_distance{INFu}, ids{nullptr} {
   children.fill(nullptr);
 }
Exemple #19
0
 Triangle(int a, int b, int c)
 : v {{a, b, c}}
 {
   n.fill(nullptr);
 }
Exemple #20
0
		vector()
		{
			elements.fill(T{0});
		}
Exemple #21
0
 /*!
  * \brief By default all elements are set to zero.
  */
 Matrix(){ d.fill( T(0.0) ); }
	TSTNode() { buckets.fill(0); }
Exemple #23
0
//
// Do all command-line argument parsing.  This includes building up the work-items
// to be processed later, and saving all the command-line options.
//
// Does not return (it exits) if command-line is fatally flawed.
//
void ProcessArguments(int argc, char* argv[])
{
    baseSamplerBinding.fill(0);
    baseTextureBinding.fill(0);
    baseImageBinding.fill(0);
    baseUboBinding.fill(0);

    ExecutableName = argv[0];
    NumWorkItems = argc;  // will include some empties where the '-' options were, but it doesn't matter, they'll be 0
    Work = new glslang::TWorkItem*[NumWorkItems];
    for (int w = 0; w < NumWorkItems; ++w)
        Work[w] = 0;

    argc--;
    argv++;
    for (; argc >= 1; argc--, argv++) {
        if (argv[0][0] == '-') {
            switch (argv[0][1]) {
            case '-':
                {
                    std::string lowerword(argv[0]+2);
                    std::transform(lowerword.begin(), lowerword.end(), lowerword.begin(), ::tolower);

                    // handle --word style options
                    if (lowerword == "shift-sampler-bindings" || // synonyms
                        lowerword == "shift-sampler-binding"  ||
                        lowerword == "ssb") {
                        ProcessBindingBase(argc, argv, baseSamplerBinding);
                    } else if (lowerword == "shift-texture-bindings" ||  // synonyms
                               lowerword == "shift-texture-binding"  ||
                               lowerword == "stb") {
                        ProcessBindingBase(argc, argv, baseTextureBinding);
                    } else if (lowerword == "shift-image-bindings" ||  // synonyms
                               lowerword == "shift-image-binding"  ||
                               lowerword == "sib") {
                        ProcessBindingBase(argc, argv, baseImageBinding);
                    } else if (lowerword == "shift-ubo-bindings" ||  // synonyms
                               lowerword == "shift-ubo-binding"  ||
                               lowerword == "sub") {
                        ProcessBindingBase(argc, argv, baseUboBinding);
                    } else if (lowerword == "auto-map-bindings" ||  // synonyms
                               lowerword == "auto-map-binding"  ||
                               lowerword == "amb") {
                        Options |= EOptionAutoMapBindings;
                    } else if (lowerword == "flatten-uniform-arrays" || // synonyms
                               lowerword == "flatten-uniform-array"  ||
                               lowerword == "fua") {
                        Options |= EOptionFlattenUniformArrays;
                    } else if (lowerword == "no-storage-format" || // synonyms
                               lowerword == "nsf") {
                        Options |= EOptionNoStorageFormat;
                    } else if (lowerword == "source-entrypoint" || // synonyms
                               lowerword == "sep") {
                        sourceEntryPointName = argv[1];
                        if (argc > 0) {
                            argc--;
                            argv++;
                        } else
                            Error("no <entry-point> provided for --source-entrypoint");
                        break;
                    } else if (lowerword == "keep-uncalled" || // synonyms
                               lowerword == "ku") {
                        Options |= EOptionKeepUncalled;
                    } else {
                        usage();
                    }
                }
                break;
            case 'H':
                Options |= EOptionHumanReadableSpv;
                if ((Options & EOptionSpv) == 0) {
                    // default to Vulkan
                    Options |= EOptionSpv;
                    Options |= EOptionVulkanRules;
                    Options |= EOptionLinkProgram;
                }
                break;
            case 'V':
                Options |= EOptionSpv;
                Options |= EOptionVulkanRules;
                Options |= EOptionLinkProgram;
                break;
            case 'S':
                shaderStageName = argv[1];
                if (argc > 0) {
                    argc--;
                    argv++;
                }
                else
                    Error("no <stage> specified for -S");
                break;
            case 'G':
                Options |= EOptionSpv;
                Options |= EOptionLinkProgram;
                // undo a -H default to Vulkan
                Options &= ~EOptionVulkanRules;
                break;
            case 'E':
                Options |= EOptionOutputPreprocessed;
                break;
            case 'c':
                Options |= EOptionDumpConfig;
                break;
            case 'C':
                Options |= EOptionCascadingErrors;
                break;
            case 'd':
                Options |= EOptionDefaultDesktop;
                break;
            case 'D':
                Options |= EOptionReadHlsl;
                break;
            case 'e':
                // HLSL todo: entry point handle needs much more sophistication.
                // This is okay for one compilation unit with one entry point.
                entryPointName = argv[1];
                if (argc > 0) {
                    argc--;
                    argv++;
                } else
                    Error("no <entry-point> provided for -e");
                break;
            case 'h':
                usage();
                break;
            case 'i':
                Options |= EOptionIntermediate;
                break;
            case 'l':
                Options |= EOptionLinkProgram;
                break;
            case 'm':
                Options |= EOptionMemoryLeakMode;
                break;
            case 'o':
                binaryFileName = argv[1];
                if (argc > 0) {
                    argc--;
                    argv++;
                } else
                    Error("no <file> provided for -o");
                break;
            case 'q':
                Options |= EOptionDumpReflection;
                break;
            case 'r':
                Options |= EOptionRelaxedErrors;
                break;
            case 's':
                Options |= EOptionSuppressInfolog;
                break;
            case 't':
                #ifdef _WIN32
                    Options |= EOptionMultiThreaded;
                #endif
                break;
            case 'v':
                Options |= EOptionDumpVersions;
                break;
            case 'w':
                Options |= EOptionSuppressWarnings;
                break;
            case 'x':
                Options |= EOptionOutputHexadecimal;
                break;
            default:
                usage();
                break;
            }
        } else {
            std::string name(argv[0]);
            if (! SetConfigFile(name)) {
                Work[argc] = new glslang::TWorkItem(name);
                Worklist.add(Work[argc]);
            }
        }
    }

    // Make sure that -E is not specified alongside linking (which includes SPV generation)
    if ((Options & EOptionOutputPreprocessed) && (Options & EOptionLinkProgram))
        Error("can't use -E when linking is selected");

    // -o or -x makes no sense if there is no target binary
    if (binaryFileName && (Options & EOptionSpv) == 0)
        Error("no binary generation requested (e.g., -V)");

    if ((Options & EOptionFlattenUniformArrays) != 0 &&
        (Options & EOptionReadHlsl) == 0)
        Error("uniform array flattening only valid when compiling HLSL source.");
}
Exemple #24
0
 /// Default constructor
 verify_info()
 {
     hist.fill(0);
 }
Exemple #25
0
 /*!
  * \brief Constructor using a user defined default value to fill the container.
  * \param value default value
  */
 Matrix(const T& value){ d.fill(value); }
Exemple #26
0
void CEXIMemoryCard::Shutdown()
{
  s_et_cmd_done.fill(nullptr);
  s_et_transfer_complete.fill(nullptr);
}
static void clearBuffers()
{
    labelsBuffer.fill(0);
    countersBuffer.fill(0);
}
 node_t() : ends(false) {
     nexts.fill(nullptr);
 }
Exemple #29
0
int main(const int argc, const char* argv[])
{
    ba.fill(string("-"));

    testApplyVectorLambda();
    testApplyVectorMemberFn();
    testApplyVectorFunctionPtr();

    testApplyListLambda();
    testApplyListMemberFn();
    testApplyListFunctionPtr();

    testApplyTupleLambda();
    testApplyTupleMemberFn();
    testApplyTupleFunctionPtr();
    testApplyMixedTupleGenericFunctor();

    testApplyArrayLambda();
    testApplyArrayMemberFn();
    testApplyArrayFunctionPtr();

    testApplyBigArrayLambda();
    testApplyBigArrayMemberFn();
    testApplyBigArrayFunctionPtr();

    testApplyConstVectorLambda();
    testApplyConstArrayMemberPtr();
    testApplyConstArrayLambda();
    testApplyConstArrayMemberPtr();

    testApplyMutableVectorLambda();
    testApplyMutableVectorMemberPtr();
    testApplyMutableArrayLambda();
    testApplyMutableArrayMemberPtr();

    testMapVectorLambda();
    testMapVectorMemberFn();
    testMapVectorFunctionPtr();

    testMapListLambda();
    testMapListMemberFn();
    testMapListFunctionPtr();

    testMapArrayLambda();
    testMapArrayMemberFn();
    testMapArrayFunctionPtr();
    testMapArrayLambdaExplicitSize();

    testMapVector2ListLambda();
    testMapList2VectorLambda();
    testMapArray2VectorLambda();
    testMapArray2ListLambda();
    testMapVector2ArrayLambda();

    testCurryFunctionPtr();
    testCurryLambda();

    testUnCurryFunctionPtr();
    testUnCurryLambda();
    testUnCurryMemberFnNoParam();
    testUnCurryMemberFnParam();

    auto sum1 = functional::foldr([] (int a, int b) { return a + b; }, 0, v);
    auto sum2 = functional::foldl([] (int a, int b) { return a + b; }, 0, v);
    auto sum3 = functional::foldl([] (int a, int b) { return a + b; }, 0, l);

    auto sum5 = functional::foldr<std::string>(&string::concat, string(), vs);
    std::cout << sum5 << std::endl;
    std::cout << typeid(sum5).name() << std::endl;

    auto sum6 = functional::foldl<std::string>(&string::concat, string(), vs);
    std::cout << sum6 << std::endl;
    std::cout << typeid(sum6).name() << std::endl;

    auto fac1 = functional::foldl([](int a, int b) { return a * b; }, 1, v);

    std::cout << sum1 << " " << sum2 << " " << sum3 << " " << fac1 << std::endl;
    
    auto vs = functional::map([](int a) { return to_string(a); }, v);

    std::cout << typeid(vs).name() << std::endl;
    std::cout << typeid(std::vector<std::string>).name() << std::endl;

    std::vector<std::string> vvs{ "1", "2", "3" };

    auto cs = functional::map(&std::string::length, vvs);

    std::cout << typeid(cs).name() << std::endl;

    auto ls = functional::map([](int a) { return to_string(a); }, l);

    std::cout << sum1 << std::endl;
    std::cout << sum2 << std::endl;

    std::cout << fac1 << std::endl;
    std::cout << factorial(4) << std::endl;
    std::cout << factorial(uint64_t(20)) << std::endl;

    auto v12 = functional::zip(v, v);
    auto v1and2 = functional::zipWith([](int a, int b) { return a + b; }, v, v);

    return 0;
}
Exemple #30
0
			void init() {
				values.fill(T(0));
				high = true;
			}