[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [5128] Improve class uncopyable
From: |
Greg Chicares |
Subject: |
[lmi-commits] [5128] Improve class uncopyable |
Date: |
Thu, 16 Dec 2010 12:59:45 +0000 |
Revision: 5128
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5128
Author: chicares
Date: 2010-12-16 12:59:45 +0000 (Thu, 16 Dec 2010)
Log Message:
-----------
Improve class uncopyable
Modified Paths:
--------------
lmi/trunk/ChangeLog
lmi/trunk/about_dialog.hpp
lmi/trunk/account_value.hpp
lmi/trunk/actuarial_table.hpp
lmi/trunk/any_member.hpp
lmi/trunk/authenticity.hpp
lmi/trunk/basic_values.hpp
lmi/trunk/callback.hpp
lmi/trunk/census_document.hpp
lmi/trunk/census_view.hpp
lmi/trunk/commutation_functions.hpp
lmi/trunk/configurable_settings.hpp
lmi/trunk/database.hpp
lmi/trunk/database_view.hpp
lmi/trunk/dbdict.hpp
lmi/trunk/death_benefits.hpp
lmi/trunk/docmanager_ex.hpp
lmi/trunk/docmdichildframe_ex.hpp
lmi/trunk/fenv_guard.hpp
lmi/trunk/file_command.hpp
lmi/trunk/fund_data.hpp
lmi/trunk/global_settings.hpp
lmi/trunk/icon_monger.hpp
lmi/trunk/ihs_irc7702.hpp
lmi/trunk/illustration_document.hpp
lmi/trunk/illustration_view.hpp
lmi/trunk/input_sequence.hpp
lmi/trunk/ledger_text_formats.cpp
lmi/trunk/ledgervalues.hpp
lmi/trunk/loads_impl.hpp
lmi/trunk/main_wx.hpp
lmi/trunk/mec_document.hpp
lmi/trunk/mec_view.hpp
lmi/trunk/mec_xml_document.hpp
lmi/trunk/msw_workarounds.hpp
lmi/trunk/multidimgrid_any.cpp
lmi/trunk/multidimgrid_any.hpp
lmi/trunk/multidimgrid_tools.hpp
lmi/trunk/multiple_cell_document.hpp
lmi/trunk/mvc_controller.hpp
lmi/trunk/name_value_pairs.hpp
lmi/trunk/null_stream.cpp
lmi/trunk/outlay.hpp
lmi/trunk/policy_view.hpp
lmi/trunk/product_data.hpp
lmi/trunk/product_editor.hpp
lmi/trunk/progress_meter.hpp
lmi/trunk/rounding_rules.hpp
lmi/trunk/rounding_view.hpp
lmi/trunk/single_cell_document.hpp
lmi/trunk/test_coding_rules.cpp
lmi/trunk/text_view.hpp
lmi/trunk/tier_view.hpp
lmi/trunk/timer.hpp
lmi/trunk/transferor.hpp
lmi/trunk/uncopyable_lmi.hpp
lmi/trunk/view_ex.hpp
lmi/trunk/xml_lmi.hpp
lmi/trunk/yare_input.hpp
Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/ChangeLog 2010-12-16 12:59:45 UTC (rev 5128)
@@ -26997,3 +26997,65 @@
rejects 'base_from_member.hpp'; lmi has no need of it, but it was
haphazardly included by 'utility.hpp'.
+20101216T1259Z <address@hidden> [656]
+
+ about_dialog.hpp
+ account_value.hpp
+ actuarial_table.hpp
+ any_member.hpp
+ authenticity.hpp
+ basic_values.hpp
+ callback.hpp
+ census_document.hpp
+ census_view.hpp
+ commutation_functions.hpp
+ configurable_settings.hpp
+ database.hpp
+ database_view.hpp
+ dbdict.hpp
+ death_benefits.hpp
+ docmanager_ex.hpp
+ docmdichildframe_ex.hpp
+ fenv_guard.hpp
+ file_command.hpp
+ fund_data.hpp
+ global_settings.hpp
+ icon_monger.hpp
+ ihs_irc7702.hpp
+ illustration_document.hpp
+ illustration_view.hpp
+ input_sequence.hpp
+ ledger_text_formats.cpp
+ ledgervalues.hpp
+ loads_impl.hpp
+ main_wx.hpp
+ mec_document.hpp
+ mec_view.hpp
+ mec_xml_document.hpp
+ msw_workarounds.hpp
+ multidimgrid_any.cpp
+ multidimgrid_any.hpp
+ multidimgrid_tools.hpp
+ multiple_cell_document.hpp
+ mvc_controller.hpp
+ name_value_pairs.hpp
+ null_stream.cpp
+ outlay.hpp
+ policy_view.hpp
+ product_data.hpp
+ product_editor.hpp
+ progress_meter.hpp
+ rounding_rules.hpp
+ rounding_view.hpp
+ single_cell_document.hpp
+ test_coding_rules.cpp
+ text_view.hpp
+ tier_view.hpp
+ timer.hpp
+ transferor.hpp
+ uncopyable_lmi.hpp
+ view_ex.hpp
+ xml_lmi.hpp
+ yare_input.hpp
+Improve class uncopyable.
+
Modified: lmi/trunk/about_dialog.hpp
===================================================================
--- lmi/trunk/about_dialog.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/about_dialog.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -53,8 +53,8 @@
/// for consistency, so does the first.
class AboutDialog
- :public wxDialog
- ,private lmi::uncopyable
+ :public wxDialog
+ ,private lmi::uncopyable<AboutDialog>
{
public:
AboutDialog(wxWindow* parent);
Modified: lmi/trunk/account_value.hpp
===================================================================
--- lmi/trunk/account_value.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/account_value.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -51,7 +51,7 @@
class LMI_SO AccountValue
:protected BasicValues
- ,virtual private lmi::uncopyable
+ ,private lmi::uncopyable<AccountValue>
{
friend class SolveHelper;
friend class run_census_in_parallel;
Modified: lmi/trunk/actuarial_table.hpp
===================================================================
--- lmi/trunk/actuarial_table.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/actuarial_table.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -131,7 +131,7 @@
/// compatibility.
class actuarial_table
- : private lmi::uncopyable
+ : private lmi::uncopyable <actuarial_table>
,virtual private obstruct_slicing<actuarial_table>
{
public:
Modified: lmi/trunk/any_member.hpp
===================================================================
--- lmi/trunk/any_member.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/any_member.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -120,8 +120,8 @@
template<typename ClassType, typename ValueType>
class holder
- :public placeholder
- ,private lmi::uncopyable
+ :public placeholder
+ ,private lmi::uncopyable<holder<ClassType,ValueType> >
{
// Friendship is extended to class any_member only to support its
// cast operations.
@@ -519,9 +519,7 @@
// By its nature, this class is uncopyable: it holds a map of
// pointers to member, which need to be initialized instead of copied
-// when a derived class is copied. Its uncopyability is implemented
-// natively: deriving from lmi::uncopyable would prevent class C
-// from deriving from MemberSymbolTable<C> and lmi::uncopyable.
+// when a derived class is copied.
//
// A do-nothing constructor is specified in order to prevent compilers
// from warning of its absence. It's protected because this class
@@ -529,6 +527,7 @@
template<typename ClassType>
class MemberSymbolTable
+ :private lmi::uncopyable<MemberSymbolTable<ClassType> >
{
typedef std::map<std::string, any_member<ClassType> > member_map_type;
typedef typename member_map_type::value_type member_pair_type;
@@ -566,9 +565,6 @@
#endif // defined __BORLANDC__
private:
- MemberSymbolTable(MemberSymbolTable const&);
- MemberSymbolTable& operator=(MemberSymbolTable const&);
-
void complain_that_no_such_member_is_ascribed(std::string const&) const;
member_map_type map_;
Modified: lmi/trunk/authenticity.hpp
===================================================================
--- lmi/trunk/authenticity.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/authenticity.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -52,7 +52,7 @@
/// peremptorily-invalid default value of JDN zero.
class Authenticity
- : private lmi::uncopyable
+ : private lmi::uncopyable <Authenticity>
,virtual private obstruct_slicing<Authenticity>
{
friend class PasskeyTest;
Modified: lmi/trunk/basic_values.hpp
===================================================================
--- lmi/trunk/basic_values.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/basic_values.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -80,7 +80,7 @@
};
class LMI_SO BasicValues
- :virtual private lmi::uncopyable
+ :private lmi::uncopyable<BasicValues>
{
public:
BasicValues(Input const& input);
Modified: lmi/trunk/callback.hpp
===================================================================
--- lmi/trunk/callback.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/callback.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -105,7 +105,7 @@
template<typename FunctionPointer>
class LMI_SO callback
- : private lmi::uncopyable
+ : private lmi::uncopyable <callback<FunctionPointer> >
,virtual private obstruct_slicing<callback<FunctionPointer> >
{
#if !defined __BORLANDC__
Modified: lmi/trunk/census_document.hpp
===================================================================
--- lmi/trunk/census_document.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/census_document.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -35,8 +35,8 @@
class WXDLLIMPEXP_FWD_CORE wxListView;
class CensusDocument
- :public wxDocument
- ,private lmi::uncopyable
+ :public wxDocument
+ ,private lmi::uncopyable<CensusDocument>
{
friend class CensusView;
Modified: lmi/trunk/census_view.hpp
===================================================================
--- lmi/trunk/census_view.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/census_view.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -46,8 +46,8 @@
class WXDLLIMPEXP_FWD_CORE wxListView;
class CensusView
- :public ViewEx
- ,virtual private lmi::uncopyable
+ : public ViewEx
+ , private lmi::uncopyable <CensusView>
,virtual private obstruct_slicing<CensusView>
{
friend class CensusDocument;
Modified: lmi/trunk/commutation_functions.hpp
===================================================================
--- lmi/trunk/commutation_functions.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/commutation_functions.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -36,7 +36,7 @@
/// Ordinary-life commutation functions.
class LMI_SO OLCommFns
- : private lmi::uncopyable
+ : private lmi::uncopyable <OLCommFns>
,virtual private obstruct_slicing<OLCommFns>
{
public:
@@ -83,7 +83,7 @@
/// for "modal", but would too easily be taken as connoting "monthly".
class LMI_SO ULCommFns
- : private lmi::uncopyable
+ : private lmi::uncopyable <ULCommFns>
,virtual private obstruct_slicing<ULCommFns>
{
public:
Modified: lmi/trunk/configurable_settings.hpp
===================================================================
--- lmi/trunk/configurable_settings.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/configurable_settings.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -46,7 +46,7 @@
/// Data members are documented in their accessors' implementations.
class LMI_SO configurable_settings
- : private lmi::uncopyable
+ : private lmi::uncopyable <configurable_settings>
,virtual private obstruct_slicing <configurable_settings>
, public xml_serializable <configurable_settings>
, public MemberSymbolTable <configurable_settings>
Modified: lmi/trunk/database.hpp
===================================================================
--- lmi/trunk/database.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/database.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -42,7 +42,7 @@
/// Database of product parameters.
class LMI_SO product_database
- : private lmi::uncopyable
+ : private lmi::uncopyable <product_database>
,virtual private obstruct_slicing<product_database>
{
friend class input_test;
Modified: lmi/trunk/database_view.hpp
===================================================================
--- lmi/trunk/database_view.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/database_view.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -38,8 +38,8 @@
class WXDLLIMPEXP_FWD_CORE wxTreeEvent;
class DatabaseView
- :public TreeGridViewBase
- ,virtual private lmi::uncopyable
+ : public TreeGridViewBase
+ , private lmi::uncopyable <DatabaseView>
,virtual private obstruct_slicing<DatabaseView>
{
public:
Modified: lmi/trunk/dbdict.hpp
===================================================================
--- lmi/trunk/dbdict.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/dbdict.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -38,7 +38,7 @@
/// Cached product database.
class LMI_SO DBDictionary
- : private lmi::uncopyable
+ : private lmi::uncopyable <DBDictionary>
,virtual private obstruct_slicing <DBDictionary>
, public xml_serializable <DBDictionary>
, public MemberSymbolTable <DBDictionary>
Modified: lmi/trunk/death_benefits.hpp
===================================================================
--- lmi/trunk/death_benefits.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/death_benefits.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -35,7 +35,7 @@
class yare_input;
class death_benefits
- : private lmi::uncopyable
+ : private lmi::uncopyable <death_benefits>
,virtual private obstruct_slicing<death_benefits>
{
public:
Modified: lmi/trunk/docmanager_ex.hpp
===================================================================
--- lmi/trunk/docmanager_ex.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/docmanager_ex.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -37,8 +37,8 @@
class WXDLLIMPEXP_FWD_CORE wxPrintData;
class DocManagerEx
- :public wxDocManager
- ,private lmi::uncopyable
+ :public wxDocManager
+ ,private lmi::uncopyable<DocManagerEx>
{
public:
explicit DocManagerEx
Modified: lmi/trunk/docmdichildframe_ex.hpp
===================================================================
--- lmi/trunk/docmdichildframe_ex.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/docmdichildframe_ex.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -71,8 +71,8 @@
#include <wx/docmdi.h>
class DocMDIChildFrameEx
- :public wxDocMDIChildFrame
- ,private lmi::uncopyable
+ :public wxDocMDIChildFrame
+ ,private lmi::uncopyable<DocMDIChildFrameEx>
{
public:
DocMDIChildFrameEx
Modified: lmi/trunk/fenv_guard.hpp
===================================================================
--- lmi/trunk/fenv_guard.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/fenv_guard.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -42,7 +42,7 @@
/// floating-point calculations that presume the invariant.
class LMI_SO fenv_guard
- : private lmi::uncopyable
+ : private lmi::uncopyable <fenv_guard>
,virtual private obstruct_slicing<fenv_guard>
{
public:
Modified: lmi/trunk/file_command.hpp
===================================================================
--- lmi/trunk/file_command.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/file_command.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -49,7 +49,7 @@
/// wx, if that ever becomes necessary.
struct LMI_SO file_command
- :private lmi::uncopyable
+ :private lmi::uncopyable<file_command>
{
void operator()(std::string const&, std::string const&) const;
};
Modified: lmi/trunk/fund_data.hpp
===================================================================
--- lmi/trunk/fund_data.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/fund_data.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -65,7 +65,7 @@
};
class LMI_SO FundData
- : private lmi::uncopyable
+ : private lmi::uncopyable <FundData>
,virtual private obstruct_slicing<FundData>
{
public:
Modified: lmi/trunk/global_settings.hpp
===================================================================
--- lmi/trunk/global_settings.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/global_settings.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -68,7 +68,7 @@
/// functions to validate their arguments.
class LMI_SO global_settings
- : private lmi::uncopyable
+ : private lmi::uncopyable <global_settings>
,virtual private obstruct_slicing<global_settings>
{
public:
Modified: lmi/trunk/icon_monger.hpp
===================================================================
--- lmi/trunk/icon_monger.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/icon_monger.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -37,8 +37,8 @@
/// Icon provider for wx interface.
class icon_monger
- :public wxArtProvider
- ,private lmi::uncopyable
+ :public wxArtProvider
+ ,private lmi::uncopyable<icon_monger>
{
public:
icon_monger();
Modified: lmi/trunk/ihs_irc7702.hpp
===================================================================
--- lmi/trunk/ihs_irc7702.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/ihs_irc7702.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -56,7 +56,7 @@
// values are especially needed for the iterative specamt calculation.
class Irc7702
- : private lmi::uncopyable
+ : private lmi::uncopyable <Irc7702>
,virtual private obstruct_slicing<Irc7702>
{
friend class FindSpecAmt;
Modified: lmi/trunk/illustration_document.hpp
===================================================================
--- lmi/trunk/illustration_document.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/illustration_document.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -49,8 +49,8 @@
class WXDLLIMPEXP_FWD_CORE wxHtmlWindow;
class IllustrationDocument
- :public wxDocument
- ,private lmi::uncopyable
+ :public wxDocument
+ ,private lmi::uncopyable<IllustrationDocument>
{
friend class IllustrationView;
Modified: lmi/trunk/illustration_view.hpp
===================================================================
--- lmi/trunk/illustration_view.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/illustration_view.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -52,8 +52,8 @@
// only for edit and run; in the census view class, it's used widely.
class IllustrationView
- :public ViewEx
- ,virtual private lmi::uncopyable
+ : public ViewEx
+ , private lmi::uncopyable <IllustrationView>
,virtual private obstruct_slicing<IllustrationView>
{
friend class IllustrationDocument;
Modified: lmi/trunk/input_sequence.hpp
===================================================================
--- lmi/trunk/input_sequence.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/input_sequence.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -238,7 +238,7 @@
};
class InputSequence
- : private lmi::uncopyable
+ : private lmi::uncopyable <InputSequence>
,virtual private obstruct_slicing<InputSequence>
{
public:
Modified: lmi/trunk/ledger_text_formats.cpp
===================================================================
--- lmi/trunk/ledger_text_formats.cpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/ledger_text_formats.cpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -142,7 +142,7 @@
}
class calculation_summary_formatter
- : private lmi::uncopyable
+ : private lmi::uncopyable <calculation_summary_formatter>
,virtual private obstruct_slicing<calculation_summary_formatter>
{
public:
@@ -682,7 +682,7 @@
}
class FlatTextLedgerPrinter
- : private lmi::uncopyable
+ : private lmi::uncopyable <FlatTextLedgerPrinter>
,virtual private obstruct_slicing<FlatTextLedgerPrinter>
{
public:
Modified: lmi/trunk/ledgervalues.hpp
===================================================================
--- lmi/trunk/ledgervalues.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/ledgervalues.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -42,7 +42,7 @@
/// This class encapsulates a frequently-used series of operations.
class IllusVal
- : private lmi::uncopyable
+ : private lmi::uncopyable <IllusVal>
,virtual private obstruct_slicing<IllusVal>
{
public:
Modified: lmi/trunk/loads_impl.hpp
===================================================================
--- lmi/trunk/loads_impl.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/loads_impl.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -79,7 +79,7 @@
/// implemented.
struct load_details
- :private lmi::uncopyable
+ :private lmi::uncopyable<load_details>
{
load_details
(int length
Modified: lmi/trunk/main_wx.hpp
===================================================================
--- lmi/trunk/main_wx.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/main_wx.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -53,7 +53,7 @@
class Skeleton
: public wxApp
- , private lmi::uncopyable
+ , private lmi::uncopyable <Skeleton>
,virtual private obstruct_slicing<Skeleton>
{
public:
Modified: lmi/trunk/mec_document.hpp
===================================================================
--- lmi/trunk/mec_document.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/mec_document.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -36,8 +36,8 @@
class WXDLLIMPEXP_FWD_CORE wxHtmlWindow;
class mec_document
- :public wxDocument
- ,private lmi::uncopyable
+ :public wxDocument
+ ,private lmi::uncopyable<mec_document>
{
friend class mec_view;
Modified: lmi/trunk/mec_view.hpp
===================================================================
--- lmi/trunk/mec_view.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/mec_view.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -62,8 +62,8 @@
};
class mec_view
- :public ViewEx
- ,virtual private lmi::uncopyable
+ : public ViewEx
+ , private lmi::uncopyable <mec_view>
,virtual private obstruct_slicing<mec_view>
{
friend class mec_document;
Modified: lmi/trunk/mec_xml_document.hpp
===================================================================
--- lmi/trunk/mec_xml_document.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/mec_xml_document.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -39,7 +39,7 @@
class mec_input;
class LMI_SO mec_xml_document
- : private lmi::uncopyable
+ : private lmi::uncopyable <mec_xml_document>
,virtual private obstruct_slicing<mec_xml_document>
{
friend class mec_document;
Modified: lmi/trunk/msw_workarounds.hpp
===================================================================
--- lmi/trunk/msw_workarounds.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/msw_workarounds.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -50,7 +50,7 @@
/// in order to let this reversal be expressed more cleanly.
class MswDllPreloader
- : private lmi::uncopyable
+ : private lmi::uncopyable <MswDllPreloader>
,virtual private obstruct_slicing<MswDllPreloader>
{
public:
Modified: lmi/trunk/multidimgrid_any.cpp
===================================================================
--- lmi/trunk/multidimgrid_any.cpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/multidimgrid_any.cpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -213,7 +213,7 @@
/// an update and it is the place to do it once for all the calls.
class GridRefreshTableDataGuard
- :private lmi::uncopyable
+ :private lmi::uncopyable<GridRefreshTableDataGuard>
{
public:
/// Construct guard for the counter, and use releaser at last exit
Modified: lmi/trunk/multidimgrid_any.hpp
===================================================================
--- lmi/trunk/multidimgrid_any.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/multidimgrid_any.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -191,7 +191,7 @@
/// was up-to-date.
class MultiDimAxisAny
- :private lmi::uncopyable
+ :private lmi::uncopyable<MultiDimAxisAny>
{
public:
MultiDimAxisAny(std::string const& name);
@@ -470,9 +470,9 @@
/// - return axis index
class MultiDimGrid
- :public wxPanel
- ,private wxGridTableBase
- ,private lmi::uncopyable
+ :public wxPanel
+ ,private wxGridTableBase
+ ,private lmi::uncopyable<MultiDimGrid>
{
friend class GridRefreshTableDataGuard;
@@ -757,8 +757,8 @@
/// PopulateChoiceList(): Fill the control with axis value labels
class MultiDimAxisAnyChoice
- :public wxChoice
- ,private lmi::uncopyable
+ :public wxChoice
+ ,private lmi::uncopyable<MultiDimAxisAnyChoice>
{
friend class MultiDimAxisAny;
Modified: lmi/trunk/multidimgrid_tools.hpp
===================================================================
--- lmi/trunk/multidimgrid_tools.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/multidimgrid_tools.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -89,8 +89,8 @@
template<typename Integral>
class AxisMaxBoundAdjuster
- :public AxisMaxBoundAdjusterBase
- ,private lmi::uncopyable
+ :public AxisMaxBoundAdjusterBase
+ ,private lmi::uncopyable<AxisMaxBoundAdjuster<Integral> >
{
public:
AxisMaxBoundAdjuster
Modified: lmi/trunk/multiple_cell_document.hpp
===================================================================
--- lmi/trunk/multiple_cell_document.hpp 2010-12-14 20:39:51 UTC (rev
5127)
+++ lmi/trunk/multiple_cell_document.hpp 2010-12-16 12:59:45 UTC (rev
5128)
@@ -37,7 +37,7 @@
#include <vector>
class LMI_SO multiple_cell_document
- : private lmi::uncopyable
+ : private lmi::uncopyable <multiple_cell_document>
,virtual private obstruct_slicing<multiple_cell_document>
{
// TODO ?? Avoid long-distance friendship...in single-cell class, too.
Modified: lmi/trunk/mvc_controller.hpp
===================================================================
--- lmi/trunk/mvc_controller.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/mvc_controller.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -408,8 +408,8 @@
/// Controller.
class MvcController
- : public wxDialog
- , private lmi::uncopyable
+ : public wxDialog
+ , private lmi::uncopyable <MvcController>
,virtual private obstruct_slicing<MvcController>
{
friend class MvcTest;
Modified: lmi/trunk/name_value_pairs.hpp
===================================================================
--- lmi/trunk/name_value_pairs.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/name_value_pairs.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -84,7 +84,7 @@
/// extra checks can easily be added if they become desirable.
class name_value_pairs
- : private lmi::uncopyable
+ : private lmi::uncopyable <name_value_pairs>
,virtual private obstruct_slicing<name_value_pairs>
{
friend int test_main(int, char*[]);
Modified: lmi/trunk/null_stream.cpp
===================================================================
--- lmi/trunk/null_stream.cpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/null_stream.cpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -45,8 +45,8 @@
template<typename CharType, typename traits = std::char_traits<CharType> >
class dev_null_stream_buffer
- :public std::streambuf
- ,private lmi::uncopyable
+ :public std::streambuf
+ ,private lmi::uncopyable<dev_null_stream_buffer<CharType,traits> >
{
public:
dev_null_stream_buffer()
Modified: lmi/trunk/outlay.hpp
===================================================================
--- lmi/trunk/outlay.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/outlay.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -35,7 +35,7 @@
class yare_input;
class modal_outlay
- : private lmi::uncopyable
+ : private lmi::uncopyable <modal_outlay>
,virtual private obstruct_slicing<modal_outlay>
{
friend class AccountValue;
Modified: lmi/trunk/policy_view.hpp
===================================================================
--- lmi/trunk/policy_view.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/policy_view.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -38,8 +38,8 @@
class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
class PolicyView
- :public ProductEditorView
- ,virtual private lmi::uncopyable
+ : public ProductEditorView
+ , private lmi::uncopyable <PolicyView>
,virtual private obstruct_slicing<PolicyView>
{
public:
Modified: lmi/trunk/product_data.hpp
===================================================================
--- lmi/trunk/product_data.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/product_data.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -76,7 +76,7 @@
/// Implicitly-declared special member functions do the right thing.
class LMI_SO product_data
- : private lmi::uncopyable
+ : private lmi::uncopyable <product_data>
,virtual private obstruct_slicing <product_data>
, public xml_serializable <product_data>
, public MemberSymbolTable <product_data>
Modified: lmi/trunk/product_editor.hpp
===================================================================
--- lmi/trunk/product_editor.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/product_editor.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -46,8 +46,8 @@
/// by the view portion of the document/view classes pair.
class ProductEditorDocument
- :public wxDocument
- ,private lmi::uncopyable
+ :public wxDocument
+ ,private lmi::uncopyable<ProductEditorDocument>
{
public:
ProductEditorDocument();
@@ -70,8 +70,8 @@
/// Common base for all product editor view classes.
class ProductEditorView
- :public ViewEx
- ,virtual private lmi::uncopyable
+ :public ViewEx
+ ,private lmi::uncopyable<ProductEditorView>
{
friend class ProductEditorDocument;
@@ -88,8 +88,8 @@
/// It contains and lays out common widgets.
class TreeGridViewBase
- :public ProductEditorView
- ,virtual private lmi::uncopyable
+ :public ProductEditorView
+ ,private lmi::uncopyable<TreeGridViewBase>
{
public:
TreeGridViewBase();
Modified: lmi/trunk/progress_meter.hpp
===================================================================
--- lmi/trunk/progress_meter.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/progress_meter.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -184,7 +184,7 @@
std::ostringstream& progress_meter_unit_test_stream();
class LMI_SO progress_meter
- :private lmi::uncopyable
+ :private lmi::uncopyable<progress_meter>
{
public:
enum enum_display_mode
Modified: lmi/trunk/rounding_rules.hpp
===================================================================
--- lmi/trunk/rounding_rules.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/rounding_rules.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -91,7 +91,7 @@
/// The 7702 and 7702A interest rate must be rounded up, if at all.
class LMI_SO rounding_rules
- : private lmi::uncopyable
+ : private lmi::uncopyable <rounding_rules>
,virtual private obstruct_slicing <rounding_rules>
, public xml_serializable <rounding_rules>
, public MemberSymbolTable <rounding_rules>
Modified: lmi/trunk/rounding_view.hpp
===================================================================
--- lmi/trunk/rounding_view.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/rounding_view.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -37,8 +37,8 @@
class RoundingDocument;
class RoundingView
- :public ProductEditorView
- ,virtual private lmi::uncopyable
+ : public ProductEditorView
+ , private lmi::uncopyable <RoundingView>
,virtual private obstruct_slicing<RoundingView>
{
public:
Modified: lmi/trunk/single_cell_document.hpp
===================================================================
--- lmi/trunk/single_cell_document.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/single_cell_document.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -39,7 +39,7 @@
class Input;
class LMI_SO single_cell_document
- : private lmi::uncopyable
+ : private lmi::uncopyable <single_cell_document>
,virtual private obstruct_slicing<single_cell_document>
{
friend class IllustrationDocument;
Modified: lmi/trunk/test_coding_rules.cpp
===================================================================
--- lmi/trunk/test_coding_rules.cpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/test_coding_rules.cpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -109,7 +109,7 @@
};
class file
- : private lmi::uncopyable
+ : private lmi::uncopyable <file>
,virtual private obstruct_slicing<file>
{
public:
Modified: lmi/trunk/text_view.hpp
===================================================================
--- lmi/trunk/text_view.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/text_view.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -52,8 +52,8 @@
/// model for some other feature someday.
class TextEditView
- :public ViewEx
- ,virtual private lmi::uncopyable
+ : public ViewEx
+ , private lmi::uncopyable <TextEditView>
,virtual private obstruct_slicing<TextEditView>
{
friend class TextEditDocument;
Modified: lmi/trunk/tier_view.hpp
===================================================================
--- lmi/trunk/tier_view.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/tier_view.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -38,8 +38,8 @@
class WXDLLIMPEXP_FWD_CORE wxTreeEvent;
class TierView
- :public TreeGridViewBase
- ,virtual private lmi::uncopyable
+ : public TreeGridViewBase
+ , private lmi::uncopyable <TierView>
,virtual private obstruct_slicing<TierView>
{
public:
Modified: lmi/trunk/timer.hpp
===================================================================
--- lmi/trunk/timer.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/timer.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -74,7 +74,7 @@
/// elapsed_msec_str(), elapsed_usec(), stop(), restart(): nomen est omen.
class LMI_SO Timer
- :private lmi::uncopyable
+ :private lmi::uncopyable<Timer>
{
friend class TimerTest;
template<typename F> friend class AliquotTimer;
Modified: lmi/trunk/transferor.hpp
===================================================================
--- lmi/trunk/transferor.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/transferor.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -116,8 +116,8 @@
/// overridden here to return true instead.
class Transferor
- :public wxValidator
- ,private lmi::uncopyable
+ :public wxValidator
+ ,private lmi::uncopyable<Transferor>
{
public:
Transferor(std::string& data, std::string const& name);
Modified: lmi/trunk/uncopyable_lmi.hpp
===================================================================
--- lmi/trunk/uncopyable_lmi.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/uncopyable_lmi.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -24,13 +24,89 @@
#include "config.hpp"
+#if !defined __BORLANDC__
+# include <boost/static_assert.hpp>
+# include <boost/type_traits/is_base_and_derived.hpp>
+#else // Defined __BORLANDC__ .
+# define BOOST_STATIC_ASSERT(deliberately_ignored) class IgNoRe
+#endif // Defined __BORLANDC__ .
+
+/// Forbid compiler to generate copy and assignment functions.
+///
+/// This implementation is an original work. The idea of a mixin with
+/// private copy and assignment members is very old and of uncertain
+/// provenance. The idea of making that mixin a template seems to have
+/// been suggested first by Cacciola:
+/// http://lists.boost.org/Archives/boost/2001/09/16912.php
+/// http://lists.boost.org/Archives/boost/2001/09/17385.php
+///
+/// This class is often seen in a non-template guise, but consider:
+///
+/// class B0 : private Uncopyable {};
+/// class B1 : private Uncopyable {};
+/// class D : public B0, public B1 {};
+///
+/// The derived class has two distinct copies of Uncopyable, to which
+/// the empty base class optimization cannot be applied:
+///
http://groups.google.com/group/comp.lang.c++.moderated/msg/6cc884d20b336d08
+/// Rewriting that example to use virtual inheritance:
+///
+/// class B0 : virtual private Uncopyable {};
+/// class B1 : virtual private Uncopyable {};
+/// class D : public B0, public B1 {};
+///
+/// is likely to introduce its own efficiency issues:
+/// http://lists.boost.org/Archives/boost/2001/09/17391.php
+///
+/// Even where such inefficiencies don't matter, the template version
+/// is preferable for its clarity. Consider:
+///
+// class Uncopyable /* non-template implementation */;
+/// class B0 : private Uncopyable {};
+/// class B1 : private Uncopyable {};
+/// class D : private Uncopyable, public B0, public B1 {};
+///
+/// Deriving class D explicitly from Uncopyable serves two purposes:
+/// it prevents the compiler from implicitly defining a copy ctor or
+/// a copy assignment operator; and it also documents that the lack of
+/// explicit declarations for those special member functions is not an
+/// oversight. As self-enforcing documentation, it belongs in class D.
+/// However, this example is likely to elicit an ambiguity warning--a
+/// Bad Thing when one strives to write code that compiles without any
+/// warnings.
+///
+/// Such warnings may be avoided by virtual inheritance, as in the
+/// second example above--though that's inefficient, as already noted.
+/// It's also not ideal for documenting the derived class, because
+/// 'virtual' belongs in the base classes:
+/// http://www.parashift.com/c++-faq-lite/multiple-inheritance.html#faq-25.9
+/// Adding a new class later, e.g.:
+/// class E : private Uncopyable, public D {};
+/// would require changing D's inheritance to virtual, yet D and E are
+/// likely to be declared in different source files.
+///
+/// The present class does requires a template parameter (which is
+/// reasonably constrained to name the class rendered uncopyable):
+///
+/// class B0 : private uncopyable<B0> {};
+/// class B1 : private uncopyable<B1> {};
+/// class D : private uncopyable<D>, public B0, public B1 {};
+///
+/// but its clarity and efficiency make it the least objectionable
+/// option.
+
namespace lmi
{
+template<typename T>
class uncopyable
{
protected:
uncopyable() {}
- ~uncopyable() {}
+ ~uncopyable()
+ {
+ // Double parentheses: don't parse comma as a macro parameter
separator.
+
BOOST_STATIC_ASSERT((boost::is_base_and_derived<uncopyable<T>,T>::value));
+ }
private:
uncopyable(uncopyable const&);
@@ -38,5 +114,19 @@
};
} // namespace lmi
+// If lmi provided unit tests that deliberately fail to compile, then
+// this could be used:
+//
+// #include "uncopyable_lmi.hpp"
+//
+// class X : private lmi::uncopyable<X> {};
+//
+// int main()
+// {
+// X x;
+// X y(x); // Error: cannot copy.
+// x = y; // Error: cannot assign.
+// }
+
#endif // uncopyable_lmi_hpp
Modified: lmi/trunk/view_ex.hpp
===================================================================
--- lmi/trunk/view_ex.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/view_ex.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -91,26 +91,9 @@
class WXDLLIMPEXP_FWD_CORE wxIcon;
class WXDLLIMPEXP_FWD_CORE wxMenuBar;
-// INELEGANT !! If both a base and a derived class derive nonvirtually
-// from boost::noncopyable
-// ,private boost::noncopyable
-// then gcc will complain
-// warning: direct base `boost::noncopyable' inaccessible in
-// [derived classes] due to ambiguity
-// Cacciola's noncopyable<T> solution here
-// http://lists.boost.org/MailArchives/boost/msg17485.php
-// http://lists.boost.org/MailArchives/boost/msg17012.php
-// is best; no good reason for dismissing it was given on the boost
-// mailing list, but presumably they didn't want to require typing
-// the template argument. The workaround used here is rightfully
-// criticized by Cacciola:
-// http://lists.boost.org/MailArchives/boost/msg17491.php
-// That criticism matters little in this particular case, but perhaps
-// it would be better to use Cacciola's idea instead of boost's.
-
class ViewEx
- :public wxView
- ,virtual private lmi::uncopyable
+ :public wxView
+ ,private lmi::uncopyable<ViewEx>
{
public:
ViewEx();
Modified: lmi/trunk/xml_lmi.hpp
===================================================================
--- lmi/trunk/xml_lmi.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/xml_lmi.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -42,7 +42,7 @@
namespace xml_lmi
{
class dom_parser
- :private lmi::uncopyable
+ :private lmi::uncopyable<dom_parser>
{
typedef xml::tree_parser DomParser;
@@ -61,7 +61,7 @@
};
class xml_document
- :private lmi::uncopyable
+ :private lmi::uncopyable<xml_document>
{
public:
xml_document(std::string const& root_node_name);
Modified: lmi/trunk/yare_input.hpp
===================================================================
--- lmi/trunk/yare_input.hpp 2010-12-14 20:39:51 UTC (rev 5127)
+++ lmi/trunk/yare_input.hpp 2010-12-16 12:59:45 UTC (rev 5128)
@@ -55,7 +55,7 @@
/// (mc_enum and tn_range classes) designed for interactive input.
class yare_input
- : private lmi::uncopyable
+ : private lmi::uncopyable <yare_input>
,virtual private obstruct_slicing<yare_input>
{
public:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [5128] Improve class uncopyable,
Greg Chicares <=