Const references?

Status: COM Error

read connection
SELECT [is_in_use], [style], [thumbnail_id] FROM FSLib_Content_Status WHERE [id]=1234737
Details:
Description: '[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'is_in_use'.'
Source: 'Microsoft OLE DB Provider for ODBC Drivers'
Error Message: 'IDispatch error #3092'
Initialising: class FSLib::Content::Status
Statement: SELECT [is_in_use], [style], [thumbnail_id] FROM FSLib_Content_Status WHERE [id]=1234737

OpenConst references? dataangel 28th February, 2008 04:45 (UTC)

This line:

  1. define NEW_PTR_PARAM_DECL(z, n, _) BOOST_PP_COMMA_IF(n) A ## n const & a ## n

Has the 'const' keyword, making it so that const references are always passed to the class's constructor. But my class's constructor has one parameter that is a non-const reference. If I comment the const part it works. Maybe should edit the recipe?

Const references? Kirit 29th February, 2008 05:37 (UTC)

dataangel said

This line:

#define NEW_PTR_PARAM_DECL(z, n, _) BOOST_PP_COMMA_IF(n) A ##  n const & a ## n

Has the 'const' keyword, making it so that const references are always passed to the class's constructor. But my class's constructor has one parameter that is a non-const reference. If I comment the const part it works. Maybe should edit the recipe?

I think you're probably right. Removing the const seems a perfectly reasonable thing to do. The reference should probably also be added using add_reference from Boost.TypeTraits, that will stop errors where variables that are already references are passed to the constructor.

I'll have a play with it when I get a chance, but do feel free to change the recipe yourself — it's as much yours as anybody else's.


This is not an official Boost site. For more information on Boost please see Boost.org.