Skip to content

Commit a11178c

Browse files
committed
Use function pointers instead of std::function
1 parent bd2c59f commit a11178c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/engine/global.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ namespace libscratchcpp
1313
/*!
1414
* \typedef BlockImpl
1515
*
16-
* BlockImpl is used to store block implementation functions as std::function in blocks.
16+
* BlockImpl is a function pointer for block implementation functions.
1717
*/
18-
using BlockImpl = std::function<Value(const BlockArgs &)>;
18+
using BlockImpl = Value (*)(const BlockArgs &);
1919

2020
/*! Generates a random number in the given interval like the random.randint() function in Python. */
2121
template<typename T>

src/engine/iblocksection.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class IBlockSection
8080
template<class F>
8181
void addBlock(const std::string &opcode, F &&f)
8282
{
83-
m_blocks[opcode] = std::bind(f, std::placeholders::_1);
83+
m_blocks[opcode] = f;
8484
}
8585

8686
/*! Assigns an input ID to an input name. */

0 commit comments

Comments
 (0)