首页 | 官方网站   微博 | 高级检索  
相似文献
 共查询到20条相似文献,搜索用时 31 毫秒
1.
In C++, multi‐dimensional arrays are often used but the language provides limited native support for them. The language, in its Standard Library, supplies sophisticated interfaces for manipulating sequential data, but relies on its bare‐bones C heritage for arrays. The MultiArray library, a part of the Boost library collection, enhances a C++ programmer's tool set with versatile multi‐dimensional array abstractions. It includes a general array class template and native array adaptors that support idiomatic array operations and interoperate with C++ Standard Library containers and algorithms. The arrays share a common interface, expressed as a generic programming concept, in terms of which generic array algorithms can be implemented. We present the library design, introduce a generic interface for array programming, demonstrate how the arrays integrate with the C++ Standard Library, and discuss the essential aspects of their implementation. Copyright © 2004 John Wiley & Sons, Ltd.  相似文献   

2.
Generic programming is an effective methodology for developing reusable software libraries. Many programming languages provide generics and have features for describing interfaces, but none completely support the idioms used in generic programming. To address this need we developed the language G. The central feature of G is the concept, a mechanism for organizing constraints on generics that is inspired by the needs of modern C++ libraries. G provides modular type checking and separate compilation (even of generics). These characteristics support modular software development, especially the smooth integration of independently developed components. In this article we present the rationale for the design of G and demonstrate the expressiveness of G with two case studies: porting the Standard Template Library and the Boost Graph Library from C++ to G. The design of G shares much in common with the concept extension proposed for the next C++ Standard (the authors participated in its design) but there are important differences described in this article.  相似文献   

3.
A style of programming that uses higher-order functions has become common in C++, following the introduction of the Standard Template Library (STL) into the standard library. In addition to their utility as arguments to STL algorithms, function parameters are useful as callbacks on GUI events, defining tasks to be executed in a thread, and so forth. C++’s mechanisms for defining functions or function objects are, however, rather verbose, and they often force the function’s definition to be placed far from its use. As a result, C++ frustrates programmers in taking full advantage of its own standard libraries. The effective use of modern C++ libraries calls for a concise mechanism for defining small one-off functions in the language, a need that can be fulfilled with lambda expressions.This paper describes a design and implementation of language support for lambda expressions in C++. C++’s compilation model, where activation records are maintained in a stack, and the lack of automatic object lifetime management make safe lambda functions and closures challenging: if a closure outlives its scope of definition, references stored in a closure dangle. Our design is careful to balance between conciseness of syntax and explicit annotations to guarantee safety. The presented design is included in the draft specification of the forthcoming major revision of the ISO C++ standard, dubbed C++0x. In rewriting typical C++ programs to take advantage of lambda functions, we observed clear benefits, such as reduced code size and improved clarity.  相似文献   

4.
The C++ programming language has undergone significant changes since its inception in the 1980s, but has now reached a relatively steady state. Standard C++ now includes a general library of container classes, the Standard Template Library (STL). These developments are rapidly changing the styles used in C++ class programming. The paper has dual purposes: it provides an introduction to STL for C++ programmers, and it develops an efficient matrix class library, built upon STL, which provides functionality useful in areas such as computational economics, finance, mathematical programming and statistics. This library, which is freely available, comprises a full set of vector and matrix operations using both dense and sparse implementations. The paper discusses approaches towards and pitfalls in constructing C++ concrete data types, and has references for further on-line information.  相似文献   

5.
本文介绍了一种可扩充、可移植的向量与矩阵库,它利用面向对象语言C++开发,适用于不同数据类型的向量和矩阵运算。文章对该库的基本结构、主要特征及扩充途径作了简要描述,并用实例演示了基于该库的应用程序编写方法。  相似文献   

6.
Visual C++以其方便的可视化集成编程环境,高效的代码实现功能,强大的基内库以及兼有低级语言可控制硬件操作的优点,成为一般工程项目的首选软件开发平台。涉及信号处理的实际工程常常需要处理复的数字信号,因此Visual C++下如何实现复数运算是工程技术中软件开发必须面对的问题。该文详细阐述了VisualC++中利用复数模板实现复数运算的方法,给出了一些基本复数运算的实现代码;并基于该方法实现了算法已知的一般复矩阵的奇异值分解(CSVD)运算,很好地满足了实际工程信号处理软件模块的需要,证明了该方法的正确性。发现了 Visual C++5.0和Visual C++6.0一个声明的复数模板函数在其标准C++库中没有具体实现,通过编写同名模板函数解决了这一问题。  相似文献   

7.
Generic programming has been defined as ‘programming with concepts’ where a concept refers to a family of abstractions. The criteria for generic programming include independence of collections from data types, independence of algorithms that operate on the collection, and the adaptability of the collections. This paper examines and evaluates the support for generic programming in the Java Development Kit (JDK) in comparison to C++'s Standard Template Library (STL). The evaluation will consider both the ‘qualitative’ factors as well as certain ‘quantitative’ factors (i.e. factors that can be measured). The qualitative factors that are considered include: 1. a comparison of the structure and APIs; 2. homogeneity versus heterogeneity; and 3. ease of use (including ease of converting to collection classes, ease of changing collection type, and ease of error handling). The quantitative factors include: 1. compiled size; 2. runtime memory usage; and 3. performance. The results of our evaluative comparisons based on the above factors and certain other criteria are presented at the end. Based on the results, we conclude that the support provided for generic programming in C++'s STL is superior to that provided by JDK. Copyright © 2003 John Wiley & Sons, Ltd.  相似文献   

8.
FC++ is a library for programming functionally in C++. Compared to other C++ functional programming libraries, FC++ is distinguished by its powerful type system which allows the manipulation of parametrically polymorphic functions (e.g., passing them as arguments to other functions and returning them as results). In this paper, we show how FC++ can be used in common object‐oriented programming tasks. We demonstrate FC++ implementations of several common design patterns (Adapter, Builder, Command, and more). Compared to conventional C++ implementations of these patterns, our implementations are either simpler (in that fewer classes/dependencies are needed), more efficient, or more type‐safe (thanks to parametric polymorphism and type inference). Copyright © 2002 John Wiley & Sons, Ltd.  相似文献   

9.
蔡辉  孟飞 《微型电脑应用》2002,18(9):56-58,47
本文介绍了C 中的标准模板库(STL)的基本概念和应用容器,迭代器、算法进行STL程序设计的过程。并结合程序实例模块,详细阐述了STL容器中对象的创建过程。  相似文献   

10.
Traditional static checking centers around finding bugs in programs by isolating cases where the language has been used incorrectly. These language‐based checkers do not understand the semantics of software libraries, and therefore cannot be used to detect errors in the use of libraries. In this paper, we introduce STLlint, a program analysis we have implemented for the C++ Standard Template Library and similar, generic software libraries, and we present the general approach that underlies STLlint. We show that static checking of library semantics differs greatly from checking of language semantics, requiring new representations of program behavior and new algorithms. Major challenges include checking the use of generic algorithms, loop analysis for interfaces, and organizing behavioral specifications for extensibility. Copyright © 2005 John Wiley & Sons, Ltd.  相似文献   

11.
Class templates represent a difficulty for C++ garbage collectors since relevant information is available only very late, at instantiation time. Current collectors therefore either fail to work with class templates or have to run in a non‐optimized mode. This paper introduces the template garbage collector (TGC), the first mostly‐copying collector that can handle class templates. It discusses the design decisions that are suggested by the specifics of generic template programming and presents performance results and memory measurements of tests with MTL and GTL, two generic C++ libraries based on the Standard Template Library. The tests show that TGC substantially improves the run times of programs with many small objects with short lifetimes or large objects with long lifetimes. The memory usage at the same time is reasonable. Since TGC modifies the mostly‐copying technique, the heap sizes are in many cases considerably smaller than they are for traditional mostly‐copying collectors. The tests also show that TGC is competitive with the Boehm–Demers–Weiser collector, the most widely used collector for C++. Copyright © 2001 John Wiley & Sons, Ltd.  相似文献   

12.
This article discusses an efficient implementation of tensors of arbitrary rank by using some of the idioms introduced by the recently published C++ ISO Standard (C++11). With the aims at providing a basic building block for high-performance computing, a single Array class template is carefully crafted, from which vectors, matrices, and even higher-order tensors can be created. An expression template facility is also built around the array class template to provide convenient mathematical syntax. As a result, by using templates, an extra high-level layer is added to the C++ language when dealing with algebraic objects and their operations, without compromising performance. The implementation is tested running on both CPU and GPU.  相似文献   

13.
Foxprow与BC++开发的DLL的对接   总被引:1,自引:0,他引:1  
本文深入探讨了利用动态连接扩充Foxprow功能的软件开发的方法,解决了Foxprow与BorlandC++开发生成的动态连接库的对接问题,为Foxprow的功能增形成了一套成熟有效的实现手段。  相似文献   

14.
After a brief review of the electroweak radiative corrections to gauge-boson self-energies, otherwise known as the direct and oblique corrections, a tool for calculation of the oblique parameters is presented. This tool, named OPUCEM, brings together formulas from multiple physics models and provides an error-checking machinery to improve reliability of numerical results. It also sets a novel example for an “open-formula” concept, which is an attempt to improve the reliability and reproducibility of computations in scientific publications by encouraging the authors to open-source their numerical calculation programs. Finally, we demonstrate the use of OPUCEM in two detailed case studies related to the fourth Standard Model family. The first is a generic fourth family study to find relations between the parameters compatible with the EW precision data and the second is the particular study of the flavor democracy predictions for both Dirac and Majorana-type neutrinos.

Program summary

Program title: OPUCEM (library)Catalogue identifier: AEIW_v1_0Program summary URL:http://cpc.cs.qub.ac.uk/summaries/AEIW_v1_0.htmlProgram obtainable from: CPC Program Library, Queen?s University, Belfast, N. IrelandLicensing provisions: Standard CPC licence, http://cpc.cs.qub.ac.uk/licence/licence.htmlNo. of lines in distributed program, including test data, etc.: 175 457No. of bytes in distributed program, including test data, etc.: 1 061 012Distribution format: tar.gzProgramming language: C/C++Computer: PCs and WorkstationsOperating system: Any Unix based system such as Linux and MacOSX, partial testing with Cygwin under WindowsRAM: GUI takes about 25 MB, the individual library calls are negligibleClassification: 11.1, 11.6External routines: ROOT library set (optional), complex number constructs from either the C99 standard or from the C++ Technical Report 1 (ISO/IEC TR 19768)Nature of problem: The calculation of Electroweak Precision variables for each point of the parameter space of a given beyond the Standard Model theory is tedious and error prone. The available formulas in the literature sometimes contain typos and most of the time they are valid only under some specific conditions, not suitable for quick comparison across different studies nor direct implementation on a computer.Solution method: One loop exact calculation of the oblique parameters are collected into a freely available C/C++ library for a number of models. One-loop exact calculation of the contributions of a number of models to the oblique parameters are collected in a freely available C/C++ library. The public availability of the implementations and the internal error checking mechanism aim the correctness of the results. Additionally, the Graphical User Interface and auxiliary tools provide the means for rapid result comparison or update when new data becomes available.Unusual features: The library computes the oblique parameters S, T and U both with exact one-loop calculations and with well-defined approximations for a number of models to establish a certain level of confidence. The comparisons between exact and approximate computations, and amongst formulas from different papers provide an error checking machinery which improves the end user reliability.Running time: Fractions of a second for each function call  相似文献   

15.
介绍使用Visual C++建立动态链接库,并通过VB编程工具进行I/O端口的访问,实现Windows环境下的直接I/O控制.  相似文献   

16.
Dyson–Schwinger equations are important tools for non-perturbative analyses of quantum field theories. For example, they are very useful for investigations in quantum chromodynamics and related theories. However, sometimes progress is impeded by the complexity of the equations. Thus automating parts of the calculations will certainly be helpful in future investigations. In this article we present a framework for such an automation based on a C++ code that can deal with a large number of Green functions. Since also the creation of the expressions for the integrals of the Dyson–Schwinger equations needs to be automated, we defer this task to a Mathematica notebook. We illustrate the complete workflow with an example from Yang–Mills theory coupled to a fundamental scalar field that has been investigated recently. As a second example we calculate the propagators of pure Yang–Mills theory. Our code can serve as a basis for many further investigations where the equations are too complicated to tackle by hand. It also can easily be combined with DoFun, a program for the derivation of Dyson–Schwinger equations.1Program summaryProgram title: CrasyDSECatalogue identifier: AEMY _v1_0Program summary URL: http://cpc.cs.qub.ac.uk/summaries/AEMY_v1_0.htmlProgram obtainable from: CPC Program Library, Queen’s University, Belfast, N. IrelandLicensing provisions: Standard CPC licence, http://cpc.cs.qub.ac.uk/licence/licence.htmlNo. of lines in distributed program, including test data, etc.: 49030No. of bytes in distributed program, including test data, etc.: 303958Distribution format: tar.gzProgramming language: Mathematica 8 and higher, C++.Computer: All on which Mathematica and C++ are available.Operating system: All on which Mathematica and C++ are available (Windows, Unix, Mac OS).Classification: 11.1, 11.4, 11.5, 11.6.Nature of problem: Solve (large) systems of Dyson–Schwinger equations numerically.Solution method: Create C++ functions in Mathematica to be used for the numeric code in C++. This code uses structures to handle large numbers of Green functions.Unusual features: Provides a tool to convert Mathematica expressions into C++ expressions including conversion of function names.Running time: Depending on the complexity of the investigated system solving the equations numerically can take seconds on a desktop PC to hours on a cluster.  相似文献   

17.
Oracle C Class Library是支持Visual C 编译器的更为灵活、简便、可靠和高效的数据库连接方法。本文分析了0racle C Class Library的工作原理及使用过程,并给出了一个使用实例,说明了该数据访问技术在数据库编程中的具体实现方法。  相似文献   

18.
A good programming language alone is not sufficient for economic software production. The programming environment has a significant influence on the productivity of software engineers. Providing a programmer with information about an object-oriented software system requires extracting information from the source code, e.g. class, method and variable names. We use separate structure files for holding this information and take advantage of proven tools such as make and the C preprocessor for keeping the structure files up to date and for processing software systems that heavily use macros. In this paper we describe the concepts used for comfortable processing of C++ software systems, and discuss interesting design and implementation aspects, including structure files, the applied make mechanism and the exploitation of the C preprocessor.  相似文献   

19.
The containment set as an extension of the range of a function has been introduced in a series of white papers; see e.g. Walster, G. W.: Closed Interval Systems, Sun Microsystems, 2002, and Walster, G. W, et al.: Extended Real Intervals and the Topological Closure of Extended Real Relations, Sun Microsystems, 2002. The containment evaluation provides an exception free evaluation of functions over an arbitrary range.In this paper we discuss alternative existing implementations (C++ Interval Arithmetic Programming Reference, Sun Microsystems, 2000, and Hofschuster, W. et al.: The Interval Library fi_lib++ 2.0, Design, Features and Sample Programs, Universität Wuppertal, 2001) of the power function, introduce a new version, develop containment sets and discuss algorithms for the implementation.  相似文献   

20.
Geoffrey Phipps 《Software》1999,29(4):345-358
An experiment was conducted to compare programmer productivity and defect rates for Java and C++. A modified version of the Personal Software Process (PSP) was used to gather defect rate, bug rate, and productivity data on C++ and Java during two real world development projects. A bug is defined to be a problem detected during testing or deployment. A defect is either a bug, or an error detected during compile time. A typical C++ program had two to three times as many bugs per line of code as a typical Java program. C++ also generated between 15 per cent and 50 per cent more defects per line, and perhaps took six times as long to debug. Java was between 30 per cent and 200 per cent more productive, in terms of lines of code per minute. When defects were measured against development time, Java and C++ showed no difference, but C++ had two to three times as many bugs per hour. Statistics were generated using Student's t‐test at a 95 per cent confidence level. Some discussion of why the differences occurred is included, but the reasons offered have not been tested experimentally. The study is limited to one programmer over two projects, so it is not a definitive experimental result. The programmer was experienced in C++, but only learning Java, so the results would probably favour Java more strongly for equally‐experienced programmers. The experiment shows that it is possible to experimentally measure the fitness of a programming language. Copyright © 1999 John Wiley & Sons, Ltd.  相似文献   

设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司    京ICP备09084417号-23

京公网安备 11010802026262号