Hello Alexander,
On 11/18/2012 03:31 PM, Alexander Lang wrote:
Hi,
Compilation fails in OSGNurbsPatchSurface.cpp, line 1509 and 1535:
error C2664: 'std::make_pair' : cannot convert parameter 1 from 'double'
to 'const double &&'
> The message is 'You cannot bind an lvalue to an rvalue reference'.
> However, VS 11 compiles if i remove the template arguments and let the
> compiler apply template argument deduction:
> std::make_pair<double, unsigned int>(vd_curvestart[ui_curve_cnt],
> ui_curve_cnt)
> becomes
> std::make_pair(vd_curvestart[ui_curve_cnt], ui_curve_cnt)
> Could that be a C++11-related issue?
given that rvalue references are a C++11 feature: yes ;) ;)
I haven't read up on the details regarding conversions of rvalue
references, but in general I prefer to use something like this for map
insertion anyway:
typedef std::map<key, value> MapType;
MapType someMap;
someMap.insert(MapType::value_type(someKey, someValue));
The attached patch changes the lines you mention to use that form
instead. Would you mind giving it a try to see if it fixes the problem
(I don't have VS 2012 yet)? Thank you!
Cheers,
Carsten
diff --git a/Source/System/NodeCores/Drawables/Nurbs/Internal/OSGNurbsPatchSurface.cpp b/Source/System/NodeCores/Drawables/Nurbs/Internal/OSGNurbsPatchSurface.cpp
index 879036c..3112ab4 100644
--- a/Source/System/NodeCores/Drawables/Nurbs/Internal/OSGNurbsPatchSurface.cpp
+++ b/Source/System/NodeCores/Drawables/Nurbs/Internal/OSGNurbsPatchSurface.cpp
@@ -1460,31 +1460,36 @@ void CNurbsPatchSurface::Gen3DLoops(const unsigned int cuiSurface)
}
}
-void CNurbsPatchSurface::CutCurve(const unsigned int cuiSurface, BezierCurve2D &rclCurve, bezier2ddeque &rclCut, std::vector<unsigned int> &rvuiUSeg, std::vector<unsigned int> &rvuiVSeg)
+void CNurbsPatchSurface::CutCurve(const unsigned int cuiSurface,
+ BezierCurve2D& rclCurve,
+ bezier2ddeque& rclCut,
+ std::vector<unsigned int>& rvuiUSeg,
+ std::vector<unsigned int>& rvuiVSeg)
{
- const int ci_u_seg_cnt = UInt32(m_vvdUParams[cuiSurface].size());
- const int ci_v_seg_cnt = UInt32(m_vvdVParams[cuiSurface].size());
- int i_u_seg;
- int i_v_seg;
- unsigned int ui_curve;
- unsigned int ui_curve_cnt = 1;
- std::vector<BezierCurve2D> vcl_curves;
- std::vector<double> vd_curvestart;
- std::vector<double> vd_curveend;
- std::vector<double> vd_int;
- unsigned int ui_int;
- BezierCurve2D cl_new_curve;
- std::multimap<double, unsigned int> mm_curve_sort;
- std::multimap<double, unsigned int>::iterator
- itmm_curve_it;
- int i_err;
-// unsigned int ui_idx;
- bool b_cut;
+ typedef std::multimap<double, unsigned int> CurveMap;
+ typedef CurveMap::iterator CurveMapIt;
+
+ const int ci_u_seg_cnt = UInt32(m_vvdUParams[cuiSurface].size());
+ const int ci_v_seg_cnt = UInt32(m_vvdVParams[cuiSurface].size());
+ int i_u_seg;
+ int i_v_seg;
+ unsigned int ui_curve;
+ unsigned int ui_curve_cnt = 1;
+ std::vector<BezierCurve2D> vcl_curves;
+ std::vector<double> vd_curvestart;
+ std::vector<double> vd_curveend;
+ std::vector<double> vd_int;
+ unsigned int ui_int;
+ BezierCurve2D cl_new_curve;
+ CurveMap mm_curve_sort;
+ CurveMapIt itmm_curve_it;
+ int i_err;
+ bool b_cut;
vcl_curves.push_back(rclCurve);
vd_curvestart.push_back(0.0);
vd_curveend.push_back(1.0);
- mm_curve_sort.insert(std::make_pair<const double, unsigned int>(0.0, 0u));
+ mm_curve_sort.insert(CurveMap::value_type(0.0, 0u));
for(ui_curve = 0; ui_curve < ui_curve_cnt; ++ui_curve)
{
@@ -1506,7 +1511,7 @@ void CNurbsPatchSurface::CutCurve(const unsigned int cuiSurface, BezierCurve2D &
vd_curvestart.push_back( (vd_curvestart[ui_curve] + vd_curveend[ui_curve]) * 0.5);
vd_curveend.push_back(vd_curveend[ui_curve]);
vd_curveend[ui_curve] = vd_curvestart[ui_curve_cnt];
- mm_curve_sort.insert(std::make_pair<const double, unsigned int>(vd_curvestart[ui_curve_cnt], ui_curve_cnt) );
+ mm_curve_sort.insert(CurveMap::value_type(vd_curvestart[ui_curve_cnt], ui_curve_cnt));
++ui_curve_cnt;
b_cut = true;
break;
@@ -1532,7 +1537,7 @@ void CNurbsPatchSurface::CutCurve(const unsigned int cuiSurface, BezierCurve2D &
vd_curvestart.push_back( (vd_curvestart[ui_curve] + vd_curveend[ui_curve]) * 0.5);
vd_curveend.push_back(vd_curveend[ui_curve]);
vd_curveend[ui_curve] = vd_curvestart[ui_curve_cnt];
- mm_curve_sort.insert(std::make_pair<const double, unsigned int>(vd_curvestart[ui_curve_cnt], ui_curve_cnt) );
+ mm_curve_sort.insert(CurveMap::value_type(vd_curvestart[ui_curve_cnt], ui_curve_cnt) );
++ui_curve_cnt;
b_cut = true;
break;
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users