Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ea527fd

Browse files
tomotakaerulava
authored andcommitted
add "inline" to get_array, color_bar, axvline
1 parent 7f7b852 commit ea527fd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

matplotlibcpp.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ template <> struct select_npy_type<uint32_t> { const static NPY_TYPES type = NPY
298298
template <> struct select_npy_type<uint64_t> { const static NPY_TYPES type = NPY_UINT64; };
299299

300300
template<typename Numeric>
301-
PyObject* get_array(const std::vector<Numeric>& v)
301+
inline PyObject* get_array(const std::vector<Numeric>& v)
302302
{
303303
detail::_interpreter::get(); //interpreter needs to be initialized for the numpy commands to work
304304
NPY_TYPES type = select_npy_type<Numeric>::type;
@@ -343,7 +343,7 @@ PyObject* get_2darray(const std::vector<::std::vector<Numeric>>& v)
343343
#else // fallback if we don't have numpy: copy every element of the given vector
344344

345345
template<typename Numeric>
346-
PyObject* get_array(const std::vector<Numeric>& v)
346+
inline PyObject* get_array(const std::vector<Numeric>& v)
347347
{
348348
PyObject* list = PyList_New(v.size());
349349
for(size_t i = 0; i < v.size(); ++i) {
@@ -355,7 +355,7 @@ PyObject* get_array(const std::vector<Numeric>& v)
355355
#endif // WITHOUT_NUMPY
356356

357357
// sometimes, for labels and such, we need string arrays
358-
PyObject * get_array(const std::vector<std::string>& strings)
358+
inline PyObject * get_array(const std::vector<std::string>& strings)
359359
{
360360
PyObject* list = PyList_New(strings.size());
361361
for (std::size_t i = 0; i < strings.size(); ++i) {
@@ -1322,7 +1322,7 @@ void text(Numeric x, Numeric y, const std::string& s = "")
13221322
Py_DECREF(res);
13231323
}
13241324

1325-
void colorbar(PyObject* mappable = NULL, const std::map<std::string, float>& keywords = {})
1325+
inline void colorbar(PyObject* mappable = NULL, const std::map<std::string, float>& keywords = {})
13261326
{
13271327
if (mappable == NULL)
13281328
throw std::runtime_error("Must call colorbar with PyObject* returned from an image, contour, surface, etc.");
@@ -1700,7 +1700,7 @@ inline void axis(const std::string &axisstr)
17001700
Py_DECREF(res);
17011701
}
17021702

1703-
void axvline(double x, double ymin = 0., double ymax = 1., const std::map<std::string, std::string>& keywords = std::map<std::string, std::string>())
1703+
inline void axvline(double x, double ymin = 0., double ymax = 1., const std::map<std::string, std::string>& keywords = std::map<std::string, std::string>())
17041704
{
17051705
// construct positional args
17061706
PyObject* args = PyTuple_New(3);

0 commit comments

Comments
 (0)