这是我的逐步方案:
但是,我无法使用“ load-post-widget”编辑获取的帖子内容,我想我不确定如何返回帖子内容,因此Gutenberg会将其视为可编辑形式。请帮助。
问:我如何将任何post.content.raw渲染为可使用Gutenberg进行编辑的react元素。
这是步骤3中的示例代码:
#include <iostream> // >>> https://gcc.godbolt.org/z/NRQSQ_
#include <omp.h> // >>> https://stackoverflow.com/questions/59637163/force-openmp-to-not-cache-a-large-object-in-each-thread/59638455?noredirect=1#comment105445758_59638455
#include <chrono>
#include <thread>
#define anIndeedLargeSIZE 2
int main()
{
//
int const largeObject[anIndeedLargeSIZE] = {0};
// #pragma omp const largeObject // largeObject_const_OMP.c:46:0: warning: ignoring #pragma omp const [-Wunknown-pragmas]
std::cout << "int const largeObject address[_" << largeObject << "_]" << std::endl;
#pragma omp parallel for num_threads(2)
for (int i = 0; i < 2; i++)
{
int tid = omp_get_thread_num();
std::this_thread::sleep_for( std::chrono::milliseconds( 100 * tid ) );
std::cout << "tid: " << (int)tid << " ::[_" << largeObject << "_]" << std::endl;
if (i == tid)
{
// largeObject[i] = tid; // const .... un-mutable mode
std::cout << "tid: " << (int)tid << " :: now reading and using an int const largeObject[" << (int)i << "] == " << largeObject[i] << std::endl;
}
}
std::cout << "int const largeObject[] processing FINISHED." << std::endl;
/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>>> ~/$ ./largeObject_const_OMP
* int const largeObject address[_0x7fff3ed0db28_]
* tid: 0 ::[_0x7fff3ed0db28_]
* tid: 0 :: now reading and using an int const largeObject[0] == 0
* tid: 1 ::[_0x7fff3ed0db28_]
* tid: 1 :: now reading and using an int const largeObject[1] == 0
* int const largeObject[] processing FINISHED.
*
* */
/*
int volatile largeObject[anIndeedLargeSIZE] = {0};
std::cout << "int volatile largeObject address[_" << largeObject << "_]" << std::endl;
#pragma omp parallel for num_threads(2)
for (int i = 0; i < 2; i++)
{
int tid = omp_get_thread_num();
std::this_thread::sleep_for( std::chrono::milliseconds( 100 * tid ) );
std::cout << "tid: " << (int)tid << " ::[_" << largeObject << "_]" << std::endl;
if (i == tid)
{
// largeObject[i] = tid; // const .... un-mutable mode
std::cout << "tid: " << (int)tid << " :: now reading and using an int volatile largeObject[" << (int)i << "] == " << largeObject[i] << std::endl;
}
}
std::cout << "int volatile largeObject[] processing FINISHED." << std::endl;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>>> ~/$ ./largeObject_const_OMP
* int volatile largeObject address[_1_]
* tid: 0 ::[_1_]
* tid: 0 :: now reading and using an int volatile largeObject[0] == 0
* tid: 1 ::[_1_]
* tid: 1 :: now reading and using an int volatile largeObject[1] == 0
* int volatile largeObject[] processing FINISHED.
* */
return 0;
}